Library Problems in OSGI-Plugin

0 views
Skip to first unread message

Sirux7

unread,
Feb 24, 2015, 8:02:37 AM2/24/15
to sta...@clarkparsia.com
Hello everyone,

I am working on a plugin for Protege 4.3 in which I would like to use Stardog. I'm starting a Stardog server manually on my machine and try to connect to it via HTTP or SNARL from within my plugin code.

Since I'm not very experienced in coding, I ran into some problems.

I am coding the plugin in Eclipse where I put stardog client .jars in the build path and compile it with an ant script that was provided to build protege plugins. To include the stardog client libraries needed for the connection I modified the ant script to simply extract all needed stardog library .jars into the root directory of my plugin .jar.

Since I did this, there are no "ClassNotFound" Exceptions anymore when using the plugin. However, I am getting the Stardog exception that says "No Driver was found which supports the connection string 'snarl://localhost:5820'" which seems to happen if .jars are missing from the class path as I read in a thread about it.

I'm guessing that this has something to do with the way Protege is loading the plugins. I guess it loads the classes that I use in my code but not the ones that those classes reference, even though they are included as well in my plugin .jar.

Can you point me to the right direction to solve this? I think extracting the stardog .jars into my .jar is not good practice to begin with. I think you can state "required packages" in the manifest file of the plugin but for this to work, the stardog libraries would have to be OSGI packages I think (again: I'm not really experienced with this).

I am including all *.jar files from these directories:

stardog-2.2.4/client/snarl
stardog-2.2.4/client/http
stardog-2.2.4/client/jena
stardog-2.2.4/client/api

My code that causes the exception looks like this:

AdminConnection aAdminConnection = AdminConnectionConfiguration.toServer("snarl://localhost:5820").credentials("admin", "admin").connect();

(Using http to connect results in the same exception for http driver)

If I try this code in a fresh eclipse project including the same .jars from the directories mentioned above it connects just fine.

Thanks in advance!
Manuel

Mike Grove

unread,
Feb 24, 2015, 8:31:08 AM2/24/15
to stardog
If including the set of jars in Eclipse works fine, but does not work as a Protege plugin, that sounds like it's an issue with how the plugin is setup.  I'm not familiar with how Protege plugins work, but if it's OSGI, you'd have to make the stardog jars OSGI compatible by hand.  You might try asking on the protege mailing list about how class loading for plugins works.

Cheers,

Mike
 

Thanks in advance!
Manuel

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

Reply all
Reply to author
Forward
0 new messages