Reputation: 6621
In our system, some classes are packaged as OSGI bundle jar file. These jar files will be used in the Glassfish server which support OSGI.
I want to write a test client code to call some methods in these bundle jar files. But I don't want to use Glassfish. I only want to use Tomcat or Jetty.
We are using Maven to management the dependency. The bundle pom is like:
<artifactId>oursystem-name-biz</artifactId>
<packaging>bundle</packaging>
<name>oursystem-name-biz</name>
Is it possible to use these bundled jar files with OSGI supporting?
Upvotes: 0
Views: 290
Reputation: 3323
It depends.
Yes, you can just put a bundle on the standard Java classpath and load classes from it, but only if those classes are in the root of the jar.
However, OSGi supports the notion of a Bundle-Classpath and that (like the Java classpath) is a path that will be searched within the bundle. That means you can create a list of locations to search, like specific subdirectories in the jar or, jars embedded in the jar. Neither of these are supported if you stick the jar on the Java classpath, so if that is your goal, make sure to avoid Bundle-Classpath.
Upvotes: 3