Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » How to include Java SE classes when starting up from the command line?(I am getting class not found exceptions when following the equnox doco)
How to include Java SE classes when starting up from the command line? [message #1003876] Tue, 22 January 2013 02:11 Go to next message
Eban Escott is currently offline Eban Escott
Messages: 61
Registered: July 2009
Member
Hi,

I have an Equinox OSGi container that starts fine using eclipse on my development machine. However, when I export the bundles and try and start it from the command line using the instructions http://www.eclipse.org/equinox/documents/quickstart-framework.php I get some class not found exceptions.

Caused by: java.lang.ClassNotFoundException: javax.sql.DataSource
 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
 at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
 at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
 at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)


This is very strange because the class that cannot be found is a standard java class. I definitely have java installed and the execution environment in the manifest requires the same verion of java.

Is there something extra I need to do?

Thanks,
Eban
Re: How to include Java SE classes when starting up from the command line? [message #1004055 is a reply to message #1003876] Tue, 22 January 2013 09:05 Go to previous messageGo to next message
BJ Hargrave is currently offline BJ Hargrave
Messages: 55
Registered: July 2009
Member
Does your bundle import the javax.sql package?
Re: How to include Java SE classes when starting up from the command line? [message #1004265 is a reply to message #1004055] Tue, 22 January 2013 17:15 Go to previous messageGo to next message
Eban Escott is currently offline Eban Escott
Messages: 61
Registered: July 2009
Member
No, it doesn't. I did change it though to import just to make sure and I still got the same exception. Shouldn't the Java SE classes be available to the class loader anyway?
Re: How to include Java SE classes when starting up from the command line? [message #1004288 is a reply to message #1004265] Tue, 22 January 2013 18:19 Go to previous messageGo to next message
BJ Hargrave is currently offline BJ Hargrave
Messages: 55
Registered: July 2009
Member
Per the OSGi spec, a bundle must import all packages it uses (but doesn't contain). Except for java.* package. But javax.* packages must be imported. When you start Equinox in the standard OSGi way, it will configure the system bundle to export the packages normally found in Java SE. I am not sure if javax.sql is one of those packages. You should check the packages exported by the system bundle.
Re: How to include Java SE classes when starting up from the command line? [message #1004328 is a reply to message #1004288] Tue, 22 January 2013 20:42 Go to previous message
Eban Escott is currently offline Eban Escott
Messages: 61
Registered: July 2009
Member
Ah yes, and I found out why it works through the eclipse IDE. Eclipse had been putting -Dosgi.compatibility.bootdelegation=true and this made the issue go away. I found a good blog explaining all this http://blog.springsource.org/2009/01/19/exposing-the-boot-classpath-in-osgi/.

Thanks for the help BJ!
Previous Topic:the rule of importing and exporting packages on OSGi
Next Topic:Installable Unit Version - feature of plugin?
Goto Forum:
  


Current Time: Fri Jul 25 05:04:45 EDT 2014

Powered by FUDForum. Page generated in 0.01853 seconds