Okay, this is very enlightening. So in my case of creating an H2 database module: 1) A few packages have compile time only dependencies...unless the H2 deployment specifically uses those 3rd party features (e.g., org.lucene). So, this is what you refer to as an optional dependency right? 2) Is there an "optional" flag for the <Import-Package> section or some other way to declare org.lucene as optional. 3) If I declare lucene optional and don't package it, but then the user does wants to use the lucene features, I need to instruct them to add the package to the proper vm sections(s) of the conf/ config.properties file? Or is their some other way?

Thanks!
Erik

On May 29, 2008, at 12:40 AM, Richard S. Hall wrote:

I would recommend option (b), since (a) hides the dependency, which will cause your bundle to fail on other frameworks or even misconfigured installations of Felix and you won't easily know why. Better to have your dependencies be explicit, so that people will know how to satisfy them.

-> richard

Erik Peterson wrote:
That did the trick! I just removed the imports using option a.

Now I have to look at what makes since in separating the current bundle into separate services: tcp server, embedded server, mixed mode, web console etc. What I'm really interested in is deploying in mixed mode (embedded and tcp db server) to get the in-vm speed advantages but still connect from external tools. Using felix I can do that now and deploy multiple services that take advantage of an embedded db.

Thanks again!

Erik


On May 28, 2008, at 1:18 PM, Karl Pauls wrote:

The issue is that the packages are not exported by the system bundle.
You can do one of the following two things:

a) remove the import from your bundle i.e.,

<Import-Package>
    !., !com.sun.*, !sun.*,*
</Import-Package>

and add/uncomment the following line in conf/config.properties

org.osgi.framework.bootdelegation=sun.*,com.sun.*

or b) add the required packages to the system bundle exports. That can be done in the conf/config.properties as well by adding it to the Java
platform package export properties. Make sure you add it to the list
that matches your version of java.

It's hard to say which approach is preferable - there are pro and cons
to both. Are you sure your bundle really needs the packages or is it
an optional dependency? Maybe just remove the import and don't add the
bootdelegation line. Then see whether your bundle does run without
access to the packages. If that is the case go with option b) but mark
the import as optional.

regards,

Karl

On Wed, May 28, 2008 at 5:16 PM, Erik Peterson <[EMAIL PROTECTED]> wrote:
I'm new to osgi/felix and am trying to wrap h2 database as an iPOJO bundle.
When starting the service from felix console I get:
"org.osgi.framework.BundleException: Unresolved package in bundle 24:
package; (package=com.sun.tools.javac)"
I'm on Mac OS X 10.5 (Leopard) which, to my understanding, includes this package in the runtime. So there is no tools.jar that needs to be imported.

Any ideas how to get this working?
Thanks!
Erik


fyi...here is the pom file I'm using if that has any impact...

<project>
 <modelVersion>4.0.0</modelVersion>
 <packaging>bundle</packaging><!-- Use the BND Maven plug-in -->
 <groupId>ipojo.examples</groupId>
 <artifactId>hello.client</artifactId>
 <version>0.8.0-SNAPSHOT</version>
 <name>Hello Service Client</name>
 <dependencies>
     <dependency>
         <groupId>ipojo.examples</groupId>
         <artifactId>hello.service</artifactId>
         <version>0.8.0-SNAPSHOT</version>
     </dependency>
     <dependency>
         <groupId>com.h2database</groupId>
         <artifactId>h2</artifactId>
         <version>1.0.72</version>
         <scope>compile</scope>
     </dependency>
 </dependencies>
 <pluginRepositories>
     <pluginRepository>
         <id>apache.snapshots</id>
         <name>snapshot plugins</name>
         <url>

http://people.apache.org/repo/m2-snapshot-repository
         </url>
         <releases>
             <enabled>false</enabled>
         </releases>
         <snapshots>
             <enabled>true</enabled>
         </snapshots>
     </pluginRepository>
 </pluginRepositories>
 <build>
     <plugins>

         <plugin>
             <groupId>org.apache.felix</groupId>
             <artifactId>maven-bundle-plugin</artifactId>
             <extensions>true</extensions>
             <version>1.4.1</version>
             <configuration>
                 <instructions>
                     <Bundle-SymbolicName>
$ {pom.artifactId}
                     </Bundle-SymbolicName>
                     <Private-Package>

ipojo.example.hello.client
                     </Private-Package>
<!--
                     <Private-Package>
                                                     org.h2.*,
ipojo.example.hello.client
                     </Private-Package>
                     -->
                     <Export-Package>
                         *
                     </Export-Package>
                     <Import-Package>
                         !., *
                     </Import-Package>

                 </instructions>
             </configuration>
         </plugin>
         <plugin>
             <groupId>org.apache.felix</groupId>
             <artifactId>maven-ipojo-plugin</artifactId>
             <version>0.8.0-SNAPSHOT</version>
             <executions>
                 <execution>
                     <goals>
                         <goal>ipojo-bundle</goal>
                     </goals>
                 </execution>
             </executions>
         </plugin>
     </plugins>
 </build>
</project>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Karl Pauls
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to