Using Stardog in Maven/OSGi

15 views
Skip to first unread message

Niels Van Hauwermeiren

unread,
Nov 29, 2014, 9:57:59 AM11/29/14
to sta...@clarkparsia.com
Hello,

I've been succesfully using Stardog in a java project for a few months now and everything works fine, but recently I'm trying to port my existing project to OSGi to make it more modular. And I have encountered a few problems with Stardog while doing this.


The main point is that Maven doesn't seem to find the libraries needed to work with Stardog. Sure there are some libraries for "groovy" or "spring" but none of those seem to be able to do even the most basic of things.


Here's an example of basic Java code to connect to a Stardog-server:

Connection aConn = ConnectionConfiguration.to(database).credentials(databaseUsername, databasePassword).server(databaseLocation).connect();

(database, databasePassword, databaseUsername and databaseLocation are Strings with the correct info in them)

This code works fine if I manually add all the jars in a regular Java-project but they don't work with Maven. Maven doesn't seem to find these dependencies. 

com.complexible.stardog.api.Connection;
com.complexible.stardog.api.ConnectionConfiguration


Running the MavenInstall.bat script as explained on the website did not help this. 


Can anyone who has successfully used Stardog in a Maven-project help me out here?

Surely, I can't be the first one with this problem?


cheers, 

Niels Van Hauwermeiren

Al Baker

unread,
Nov 29, 2014, 10:05:36 AM11/29/14
to Stardog

Niels,

Make sure your Maven is configured to use your local m2 cache repository.   That's where the mavenInstall script places the jars.

If you use Gradle, use the mavenLocal () call before mavenCentral ().  For Maven proper, the setting goes in your settings.xml.

Regards,
Al

--
-- --
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

Niels Van Hauwermeiren

unread,
Nov 29, 2014, 3:28:11 PM11/29/14
to sta...@clarkparsia.com
Al,

It was indeed a matter of configuring my settings.xml and then updating the local repository index under netBeans Everything works fine now.

Thanks for the fast reply,

Niels

Niels Van Hauwermeiren

unread,
Nov 30, 2014, 11:29:26 AM11/30/14
to sta...@clarkparsia.com
Hi Al,

I have a bit of a follow-up question regarding the same issue as yesterday.

So after configuring my settings.xml Maven managed to find the packages and I could work with them as usual. Which I spent most of today doing.


However this only seems to work at compile-time. once I try to run the osgi-bundle in glassfish it gets installed, but not started.


Trying to manually start it gives me this error:


org.osgi.framework.BundleException: Unresolved constraint in bundle thesis.DataBroker [330]: Unable to resolve 330.1: missing requirement [330.1] osgi.wiring.package; (osgi.wiring.package=com.complexible.common.iterations)

If I get it correctly he doesn't actually load the needed jar into the bundle and thus can't properly run?

So do you have any idea what is causing this weird behaviour  and how to solve this? 


Cheers,

Niels


Al Baker

unread,
Dec 1, 2014, 11:01:30 AM12/1/14
to sta...@clarkparsia.com
Hi Niels,

The Stardog jars do not include a Manifest line for the packages they export for use w/ OSGi, so you’ll have to add them to your own, see here for a discussion on this topic:


Thanks,
Al
Reply all
Reply to author
Forward
0 new messages