Stardog 4.1 and Spring problems

8 views
Skip to first unread message

Mark James

unread,
Jun 3, 2016, 8:54:11 AM6/3/16
to Stardog
Hi Guys,
I've recently upgraded to stardog 4.1. I also had to update stardog-spring. Stardog-spring 3.1.1 works with 4.0.5 without issue. But after upgrading to 4.1 I was getting runtime errors so I upgraded stardog-spring to 4.0-RC2. At the same time I updated the other stardog related artifacts to 4.1. Compiling was fine but I got the following error at runtime -

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stardogDS' defined in URL [file:/home/ubuntu/smarta/conf/smartaengine/camel-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/openrdf/model/impl/SimpleValueFactory

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:736)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)

at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)

at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)

at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)

at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4760)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5184)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)

at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:919)

at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1704)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)


My Spring Context has the following entry -
<!-- Stardog config
-->  
<bean name="stardogDS" class="com.complexible.stardog.ext.spring.DataSourceFactoryBean">
<property name="to" value="${db.name}"/>
        <property name="username" value="${db.username}"/>
        <property name="password" value="${db.password}"/>
        <property name="url" value="${db.url}"/>
</bean>

My pom has the following entries.

<!-- Stardog and Snarl -->

<dependency>

                        <groupId>com.complexible.stardog.sesame</groupId>

                        <artifactId>stardog-sesame-core</artifactId>

                        <version>4.1</version>

                </dependency>

                <dependency>

                        <groupId>com.complexible.stardog</groupId>

                        <artifactId>client-http</artifactId>

                        <version>4.1</version>

                        <type>pom</type>

                </dependency>

<dependency>

                        <groupId>com.complexible.stardog</groupId>

                        <artifactId>client-http</artifactId>

                        <version>4.1</version>

                        <type>pom</type>

                </dependency>

                <dependency>

                        <groupId>com.complexible.stardog</groupId>

                        <artifactId>client-snarl</artifactId>

                        <version>4.1</version>

                        <type>pom</type>

                </dependency>

                <dependency>

                        <groupId>com.complexible.stardog</groupId>

                        <artifactId>server</artifactId>

                        <version>4.1</version>

                        <exclusions>

                                <exclusion>

                                        <groupId>com.complexible</groupId>

                                        <artifactId>annex</artifactId>

                                </exclusion>

                        </exclusions>

                        <type>pom</type>

                </dependency>

                <dependency>

                        <groupId>com.complexible.annex</groupId>

                        <artifactId>annex</artifactId>

                        <version>0.6.4</version>

                        <exclusions>

                                <exclusion>

                                        <groupId>com.complexible.stardog</groupId>

                                        <artifactId>server</artifactId>

                                </exclusion>

                                <exclusion>

                                        <groupId>com.complexible.stardog</groupId>

                                        <artifactId>client-http</artifactId>

                                </exclusion>

                                <exclusion>

                                        <groupId>com.complexible.stardog</groupId>

                                        <artifactId>client-snarl</artifactId>

                                </exclusion>

                        </exclusions>

                </dependency>

                <dependency>

                    <groupId>com.complexible.stardog</groupId>

                    <artifactId>stardog-spring</artifactId>

                    <version>4.0-RC2</version>

                        <exclusions>

                                <exclusion>

                                        <groupId>org.openrdf.sesame</groupId>

                                        <artifactId>sesame</artifactId>

                                </exclusion>

                                <exclusion>

                                        <groupId>com.complexible.stardog</groupId>

                                        <artifactId>client-http</artifactId>

                                </exclusion>

                                <exclusion>

                                        <groupId>com.complexible.stardog</groupId>

                                        <artifactId>client-snarl</artifactId>

                                </exclusion>

                        </exclusions>

                </dependency>


Any help on what's going wrong and why would be great. I assume I have a version issue in here somewhere?


cheers

Mark

Zachary Whitley

unread,
Jun 3, 2016, 9:48:20 AM6/3/16
to Stardog
Stardog-spring is currently built against 4.0-RC2 and you're running Stardog 4.1. I believe there should be some updates to Stardog-Spring coming soon that will probably resolve those issues. All Baker should be able to provide a better idea of when exactly you can expect too see them.

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en
---
You received this message because you are subscribed to the Google Groups "Stardog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.

Al Baker

unread,
Jun 3, 2016, 9:48:49 AM6/3/16
to Stardog
Hi Mark,

The latest 4.1 jar is now up on Maven central - my mistake - that should solve the issue if you just change the version in your POM.

Let me know there are any issues after the update.

Thanks,
Al


--

Mark James

unread,
Jun 3, 2016, 7:03:21 PM6/3/16
to sta...@clarkparsia.com
Thanks Al.

I've updated my POM, it builds fine but I'm still getting the same runtime error on startup (below). Do I need to update my spring version? Or the Annex version?

cheers
Mark

[localhost-startStop-1] 03Jun2016 22:56:59,120 ERROR org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:331) - Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stardogDS' defined in URL [file:/home/ubuntu/smarta/conf/smartaengine/camel-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/openrdf/model/impl/SimpleValueFactory

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)

---
You received this message because you are subscribed to the Google Groups "Stardog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.



--
Mark James | Smarta Systems Pty Ltd
+61 433 922 944mja...@smarta.io | smarta.io

Zachary Whitley

unread,
Jun 3, 2016, 7:50:36 PM6/3/16
to sta...@clarkparsia.com
Try removing the exclusion for sesame. 

Mark James

unread,
Jun 3, 2016, 8:11:14 PM6/3/16
to sta...@clarkparsia.com
Thanks for the suggestion Zachary. Unfortunately still no luck.

I'll play around with the other exclusions. Al recommended I put them in a year ago due to dependency problems in the 3.1.1 build. It's possible they're redundant or are causing other problems now.

cheers
Mark

Al Baker

unread,
Jun 3, 2016, 8:12:41 PM6/3/16
to sta...@clarkparsia.com
You don't need anything else now, just the Stardog Spring dependency. That advice was for the 3.x release cycle.

Al

Mark James

unread,
Jun 3, 2016, 8:13:15 PM6/3/16
to sta...@clarkparsia.com
Thanks Al. Will strip things back.

Mark James

unread,
Jun 3, 2016, 8:33:12 PM6/3/16
to sta...@clarkparsia.com
Hi Al,
When stripping things back to this -
 <dependency>
                    <groupId>com.complexible.stardog</groupId>
                    <artifactId>stardog-spring</artifactId>
                    <version>4.1</version>
 </dependency>

I now get this error -

[ERROR] Failed to execute goal on project SmartaEngine: Could not resolve dependencies for project SmartaEngine:SmartaEngine:war:0.0.1-SNAPSHOT: The following artifacts could not be resolved: com.complexible.stardog:client-http:jar:4.1, com.complexible.stardog:client-snarl:jar:4.1: Could not find artifact com.complexible.stardog:client-http:jar:4.1 in stardog-public (http://maven.stardog.com) -> [Help 1]

cheers

Mark

Zachary Whitley

unread,
Jun 3, 2016, 9:52:09 PM6/3/16
to sta...@clarkparsia.com
Do you have the Stardog maven repo in your repositories section of your Pom?

<repositories>
  <repository> 
    <id>stardog-public</id> 
    <url>http://maven.stardog.com</url>
  </repository>
</repositories>

Can you post your complete Pom file?

Sent from my iPad

Mark James

unread,
Jun 3, 2016, 10:02:14 PM6/3/16
to sta...@clarkparsia.com
Yes, I do. Full POM attached. 

 
pom.xml

Zachary Whitley

unread,
Jun 3, 2016, 10:26:30 PM6/3/16
to sta...@clarkparsia.com
I'm only on my iPad but it looks like you're depending on spring 4.1.6.release and stardog-spring depends on spring 4.1.2.release. It also looks like the beginning comment <!-- in the stardog deeps section is one line off and it probably isn't a valid xml file at the moment because of no matching end tag. Be careful about your logging deeps too. 

Sent from my iPad
<pom.xml>

Mark James

unread,
Jun 3, 2016, 10:32:17 PM6/3/16
to sta...@clarkparsia.com
Thanks Zachary. I appreciate you having a look. 
I've been commenting things in and out while trying to get this working so maybe I have slipped up there. 

Will make the Spring version change and see if that makes a difference. 

Will also check what's happening with the logging.

cheers
Mark

Al Baker

unread,
Jun 6, 2016, 2:10:35 PM6/6/16
to sta...@clarkparsia.com
Hi Mark,

Any luck from last week?

I created a spring boot starter 1.3.5 and built a small application, it looks like everything does work if you put the exclusions back on the stardog-spring dependency and add the explicit client-snarl and client-http dependencies in the main pom with the “<type>pom</type>” qualifier on them.

As for the applicationContext, I used the same one from the stardog-spring Junit and was able to have a small web app run a query.  In this case with the @ImportResource annotation for spring boot to read in the classic applicationContext.xml, but I don’t see an issue with creating the bean definition using the latest annotation methods.

Can you share how you are creating the DataSourceFactory/datasource bean?

Thanks,
Al

Mark James

unread,
Jun 8, 2016, 3:19:14 AM6/8/16
to sta...@clarkparsia.com
Hi Al,
Sorry for the slow response.

Yep, all sorted now. I should've looked harder at the changes you'd made.

I updated our own code to use com.complexible.common.rdf.model.Values which I think was the change that did the trick.

cheers
Mark
Reply all
Reply to author
Forward
0 new messages