You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Elliot Huntington <el...@gmail.com> on 2013/11/11 18:59:42 UTC

How to make non-osgi jar available to felix launcher?

I'm launching the felix launcher with:

$ java -jar bin/felix.jar

The application contains:

app/
app/bin/felix.jar
app/bundle/*.jar
app/conf/config.properties

This application uses JavaFX so I did:

$ mv $JAVA_HOME/jre/lib/jfxrt.jar $JAVA_HOME/jre/lib/ext/

And then I set the property org.osgi.framework.system.packages.extra to
expose the javafx.* packages to the container. This works appropriately
because the jfxrt.jar file is on the system classpath.

Now I have a 3rd party jar which is not an OSGi bundle. I used the bnd tool
to modify the manifest to contain the needed OSGi meta-data. I verified
that it exports the specific packages that I need, placed the jar in the
app/bundle directory, and I verified that my bundle imports the same needed
packages. I still get a ClassNotFoundException.

Is there a way, with the default launcher in felix.jar, to specify some
directory that contains non osgi jar files that can be used on the
classpath similar to what is being done with the combination of
$JAVA_HOME/jre/lib/ext/ and the org.osgi.framework.system.packages.extra
property?

I know this is NOT the recommended (or best) way to do this, but I haven't
been able to figure out how to make it work the right way.

If it helps, I created a project on GitHub that demonstrates the problem
I'm having. It is located at
https://github.com/axiopisty/scala-actors-javafx-osgi-demo.

Thanks,
Elliot

Re: How to make non-osgi jar available to felix launcher?

Posted by Neil Bartlett <nj...@gmail.com>.
You seem to be on the right track in terms of making the 3rd party library into a bundle. You got a ClassNotFoundException because of a missing import package... typically you just need to look at the package of the class that is reported missing, and ensure that is added to the imports.

If you're sure that you've already done that, then please report the contents of your Import-Package along with the details of the error.

If you really want to put non-OSGi libraries on the classpath, then just use the "-classpath" argument when you run Java -- i.e., just as you would with any normal Java application. There is no special directory for this.

Regards
Neil

On 11 November 2013 at 18:00:20, Elliot Huntington (elliot.huntington@gmail.com) wrote:

I'm launching the felix launcher with: 

$ java -jar bin/felix.jar 

The application contains: 

app/ 
app/bin/felix.jar 
app/bundle/*.jar 
app/conf/config.properties 

This application uses JavaFX so I did: 

$ mv $JAVA_HOME/jre/lib/jfxrt.jar $JAVA_HOME/jre/lib/ext/ 

And then I set the property org.osgi.framework.system.packages.extra to 
expose the javafx.* packages to the container. This works appropriately 
because the jfxrt.jar file is on the system classpath. 

Now I have a 3rd party jar which is not an OSGi bundle. I used the bnd tool 
to modify the manifest to contain the needed OSGi meta-data. I verified 
that it exports the specific packages that I need, placed the jar in the 
app/bundle directory, and I verified that my bundle imports the same needed 
packages. I still get a ClassNotFoundException. 

Is there a way, with the default launcher in felix.jar, to specify some 
directory that contains non osgi jar files that can be used on the 
classpath similar to what is being done with the combination of 
$JAVA_HOME/jre/lib/ext/ and the org.osgi.framework.system.packages.extra 
property? 

I know this is NOT the recommended (or best) way to do this, but I haven't 
been able to figure out how to make it work the right way. 

If it helps, I created a project on GitHub that demonstrates the problem 
I'm having. It is located at 
https://github.com/axiopisty/scala-actors-javafx-osgi-demo. 

Thanks, 
Elliot