It's been suggested to use DynamicImport-Package declaration. However, based on 
my quick and limited research this is not a 'preferred' method.

http://blog-o-lok.blogspot.com/2008/01/osgi-and-dynamicimport-package.html
http://www.osgi.org/blog/2007/06/osgi-and-hibernate.html

In particular the second blog post on the OSGi Alliance web site from 06/2007 
suggests that "In the next release of the OSGi specification we must find a 
solution to this problem."

So, is using DynamicImport-Package the best way to solve my problem?

________________________________
From: Nima Kaviani [mailto:[email protected]]
Sent: Monday, September 28, 2009 5:55 PM
To: Joel Schuster
Subject: Re: bnd & forced packages

Hi Joel

try <DynamicImport-Package>oracle.jdbc.driver.*</DynamicImport-Package> in your 
POM/BND file and see if it solves the problem.

-Nima
On Mon, Sep 28, 2009 at 3:48 PM, Joel Schuster 
<[email protected]<mailto:[email protected]>> wrote:
There have been a couple of times where I've been using systems where the 
package/class that I'm trying to use is being loaded dynamically.

For example, the 'standard' way to use a JDBC driver is something like this:

String driverName = "oracle.jdbc.driver.OracleDriver";
Class.forName(driverName);

Or in the case of Jaxb and using JAXBContext with a marshaller:

     JAXBContext jaxbContext = JAXBContext.newInstance( contextName);


In both these cases I've had a really hard time forcing the bnd ant task to 
have Imports for the packages I need. Including them like this doesn't work:

Import-Package: oracle.jdbc.driver.*

Instead I've had to explicitly create a 'fake' instance of the Driver 
(literally, new oracle.jdbc.driver.OracleDriver()) so that it's included in the 
imports and then bnd seems to be able to pick it up.

There has got to be a better way. What am I missing?

________________________________

Joel Schuster
Senior Software Engineer
NAVSYS Corporation
14960 Woodcarver Road, Colorado Springs, CO 80921
719-481-4877





--
http://nima.magic.ubc.ca

Reply via email to