On 11/5/07, William Tam <[EMAIL PROTECTED]> wrote:
>
> Does anybody have any success starting camel bundles (say the
> camel-core bundle) in an osgi container? I have tried doing that
> (installing went fine) with the camel-core bundle in felix and there
> were unresolved packages (jaxb-api, common-logging, and
> springframework). I was able to wrap jaxb-api and common-logging
> jars as bundles following the procedures in
> http://felix.apache.org/site/creating-bundles-using-bnd.html .
> However, wrapping springframework is rather daunting since it pulls in
> dependencies after dependencies. The new spring jars (2.1) are
> already osgi bundles but I don't think I can use them since they are
> versioned (as 2.1.0.m4). Camel-core would import the default version
> (0.0.0).
The version 0.0.0 actually tells the framework to import the highest
numbered package that has been resolved in the OSGi framework, so if you
have the spring bundles installed (or even multiple versions of them) a
bundle importing a spring package with 0.0.0 will just use the highest
version it finds. Give it a try.
One way to hack it (as follow) is to use the DynamicImport-Package
> attribute to allow the osgi container to resolve those packages from
> its classpath. I wonder if anybody has any advice.
I would not use DynamicImport-Package unless it is absolutely necessary
since it masks problems with proper setup of bundle import and exports.
Good luck,
Chris
Thanks,
> William
>
> <plugin>
> <groupId> org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <version>${felix-version}</version>
> <extensions>true</extensions>
> <configuration>
> <instructions>
> <Bundle-Name>${artifactId}</Bundle-Name>
> <Bundle-SymbolicName>${ camel.osgi.symbolic.name
> }</Bundle-SymbolicName>
> <Export-Package>${camel.osgi.export}</Export-Package>
> <Import-Package>${camel.osgi.import}</Import-Package>
> <Private-Package>${camel.osgi.private.pkg
> }</Private-Package>
> <Implementation-Title>Apache Camel</Implementation-Title>
> <Implementation-Version>${ project.version
> }</Implementation-Version>
> <Private-Package>${camel.osgi.private.pkg
> }</Private-Package>
>
> <DynamicImport-Package>javax.xml.bind.annotation.adapters,
> org.springframework.jmx.export.metadata ,
> org.springframework.jmx.export.annotation, javax.xml.stream,
> org.apache.commons.logging, org.springframework.jmx.export.assembler,
> javax.xml.bind.annotation</DynamicImport-Package>
> </instructions>
> </configuration>
> </plugin>
>