Charles, I have got past the compile error. What is odd is that the container won't start my bundle:
<plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>2.1.0</version> <extensions>true</extensions> <configuration> <instructions> <Bundle-SymbolicName>osgi.org.codehaus.btm</Bundle-SymbolicName> <Export-Package>bitronix.tm.resource.jdbc,bitronix.tm ,bitronix.tm.internal,bitronix.tm.journal,bitronix.tm.recovery,bitronix.tm.resource,bitronix.tm.resource.common,bitronix.tm.resource.jdbc.lrc,bitronix.tm.timer,bitronix.tm.twopc,bitronix.tm.twopc.executor,bitronix.tm.utils</Export-Package> <Import-Package>com.mysql.jdbc.jdbc2.optional,javax.crypto,javax.crypto.spec,javax.jms,javax.naming,javax.naming.spi,javax.sql,javax.transaction,javax.transaction.xa,org.slf4j</Import-Package> </instructions> <unpackBundle>true</unpackBundle> </configuration> </plugin> The error I get from Karaf is: *karaf@root> osgi:restart 108* *org.osgi.framework.BundleException: Unresolved constraint in bundle osgi.org.codehaus.btm [108]: Unable to resolve 108.0: missing requirement [108.0]* *package; (package=javax.jms)* Whereas the package is imported and exported... Julien. 2012/8/13 Charles Moulliard <[email protected]> > You have to add these packages in the Import-Package tag as they are > required by the bnd tool. This is due to the fact that you define your self > the packages to be used and does not let the tool to discover them using * > symbol > > > On Mon, Aug 13, 2012 at 5:34 PM, Julien Martin <[email protected]> wrote: > >> Charles, >> >> I see... Do you see anything wrong with my pom? It does not compile with >> the following error: >> >> *[ERROR] Error building bundle osgi.org.codehaus.btm:btm:bundle:2.1.2 : >> Unresolved references to [javax.crypto, javax.crypto.spec, javax.jms,* >> >> Do you have any idea why it requires JMS for instance?? >> >> Regards, >> J. >> >> >> 2012/8/13 Charles Moulliard <[email protected]> >> >>> This is because the maven bundle tool (= bnd) will calculate and add >>> missing packages. So don't worry about that for the moment. >>> >>> >>> On Mon, Aug 13, 2012 at 5:22 PM, Julien Martin <[email protected]> wrote: >>> >>>> Hello, >>>> >>>> I am having problem understanding how to configure the shade plugin: >>>> >>>> What I have in the actual manifest does not match what I have specified >>>> in the POM's plugin i.e. there are many more entries in the actual >>>> manifest than there are in the POM's plugin... >>>> >>>> Any idea? >>>> >>>> Regards, >>>> >>>> Julien. >>>> >>>> Here is my POM: >>>> >>>> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=" >>>> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" >>>> http://maven.apache.org/POM/4.0.0 >>>> http://maven.apache.org/xsd/maven-4.0.0.xsd"> >>>> <modelVersion>4.0.0</modelVersion> >>>> <groupId>osgi.org.codehaus.btm</groupId> >>>> <artifactId>btm</artifactId> >>>> <version>2.1.2</version> >>>> <packaging>bundle</packaging> >>>> <dependencies> >>>> <dependency> >>>> <groupId>org.codehaus.btm</groupId> >>>> <artifactId>btm</artifactId> >>>> <version>2.1.2</version> >>>> <optional>true</optional> >>>> </dependency> >>>> </dependencies> >>>> <build> >>>> <defaultGoal>install</defaultGoal> >>>> <plugins> >>>> <plugin> >>>> <groupId>org.apache.maven.plugins</groupId> >>>> <artifactId>maven-shade-plugin</artifactId> >>>> <version>1.1</version> >>>> <executions> >>>> <execution> >>>> <phase>package</phase> >>>> <goals> >>>> <goal>shade</goal> >>>> </goals> >>>> <configuration> >>>> <artifactSet> >>>> <includes> >>>> <include>org.codehaus.btm:btm</include> >>>> </includes> >>>> </artifactSet> >>>> <filters> >>>> <filter> >>>> <artifact>org.codehaus.btm:btm</artifact> >>>> <excludes> >>>> <exclude>**</exclude> >>>> </excludes> >>>> </filter> >>>> </filters> >>>> <promoteTransitiveDependencies>true</promoteTransitiveDependencies> >>>> <createDependencyReducedPom>true</createDependencyReducedPom> >>>> </configuration> >>>> </execution> >>>> </executions> >>>> </plugin> >>>> <plugin> >>>> <groupId>org.apache.felix</groupId> >>>> <artifactId>maven-bundle-plugin</artifactId> >>>> <version>2.1.0</version> >>>> <extensions>true</extensions> >>>> <configuration> >>>> <instructions> >>>> <Bundle-SymbolicName>osgi.org.codehaus.btm</Bundle-SymbolicName> >>>> <Export-Package>bitronix.tm.resource.jdbc,bitronix.tm >>>> ,bitronix.tm.internal,bitronix.tm.journal,bitronix.tm.recovery,bitronix.tm.resource,bitronix.tm.resource.common,bitronix.tm.resource.jdbc.lrc,bitronix.tm.timer,bitronix.tm.twopc,bitronix.tm.twopc.executor,bitronix.tm.utils</Export-Package> >>>> <Import-Package>com.mysql.jdbc.jdbc2.optional</Import-Package> >>>> </instructions> >>>> <unpackBundle>true</unpackBundle> >>>> </configuration> >>>> </plugin> >>>> </plugins> >>>> </build> >>>> >>>> </project> >>>> >>>> 2012/8/13 Charles Moulliard <[email protected]> >>>> >>>>> It is time now that you discover the maven-bundle-plugin in charge to >>>>> generate properly the MANIFEST.mf file containing bundle instructions ( >>>>> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html& >>>>> http://karaf.apache.org/manual/2.2.8/developers-guide/creating-bundles.html >>>>> ) >>>>> >>>>> Add this package into the Import-Package tag >>>>> >>>>> >>>>> >>>>> >>>>> On Mon, Aug 13, 2012 at 4:11 PM, Julien Martin <[email protected]>wrote: >>>>> >>>>>> Thanks again Charles! >>>>>> >>>>>> No it does not import it (see output): >>>>>> >>>>>> *karaf@root> packages:imports 79* >>>>>> *System Bundle (0): javax.crypto; version=0.0.0* >>>>>> *System Bundle (0): javax.crypto.spec; version=0.0.0* >>>>>> *System Bundle (0): javax.naming; version=0.0.0* >>>>>> *System Bundle (0): javax.naming.spi; version=0.0.0* >>>>>> *System Bundle (0): javax.rmi; version=0.0.0* >>>>>> *System Bundle (0): javax.sql; version=0.0.0* >>>>>> *System Bundle (0): javax.swing; version=0.0.0* >>>>>> *System Bundle (0): javax.swing.border; version=0.0.0* >>>>>> *System Bundle (0): javax.swing.event; version=0.0.0* >>>>>> *System Bundle (0): javax.swing.table; version=0.0.0* >>>>>> *System Bundle (0): javax.swing.tree; version=0.0.0* >>>>>> *OPS4J Pax Logging - API (4): org.slf4j; version=1.6.4* >>>>>> *OPS4J Pax Logging - API (4): org.slf4j; version=1.6.1* >>>>>> *OPS4J Pax Logging - API (4): org.slf4j; version=1.5.11* >>>>>> *OPS4J Pax Logging - API (4): org.slf4j; version=1.4.3* >>>>>> *jta (70): javax.transaction; version=0.0.0* >>>>>> *jta (70): javax.transaction.xa; version=0.0.0* >>>>>> >>>>>> How do I configure it so that is properly imports the required >>>>>> packages? >>>>>> Regards, >>>>>> J. >>>>>> >>>>>> 2012/8/13 Charles Moulliard <[email protected]> >>>>>> >>>>>>> Can you check please that your bundle 79 imports well this package ( >>>>>>> *com.mysql.jdbc.jdbc2.optional) by using this command ?* >>>>>>> * >>>>>>> * >>>>>>> *packages:imports 79 >>>>>>> * >>>>>>> >>>>>>> On Mon, Aug 13, 2012 at 4:03 PM, Julien Martin <[email protected]>wrote: >>>>>>> >>>>>>>> Hello, >>>>>>>> >>>>>>>> I've successfully managed for Karaf to pick up my Spring >>>>>>>> configuration files. However, I get now a ClassNotFoundException: >>>>>>>> >>>>>>>> *Caused by: java.lang.ClassNotFoundException: >>>>>>>> com.mysql.jdbc.jdbc2.optional.MysqlXADataSource not found by btm*[79] >>>>>>>> at >>>>>>>> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787) >>>>>>>> at >>>>>>>> org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71) >>>>>>>> at >>>>>>>> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768) >>>>>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:247) >>>>>>>> at java.lang.Class.forName0(Native Method) >>>>>>>> at java.lang.Class.forName(Class.java:169) >>>>>>>> at >>>>>>>> bitronix.tm.utils.ClassLoaderUtils.loadClass(ClassLoaderUtils.java:63) >>>>>>>> at >>>>>>>> bitronix.tm.resource.common.XAPool.createXAFactory(XAPool.java:300) >>>>>>>> at bitronix.tm.resource.common.XAPool.<init>(XAPool.java:63) >>>>>>>> at >>>>>>>> bitronix.tm.resource.jdbc.PoolingDataSource.buildXAPool(PoolingDataSource.java:89) >>>>>>>> at >>>>>>>> bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:76) >>>>>>>> ... 21 more >>>>>>>> >>>>>>>> What strikes me is that my Mysql driver is properly installed into >>>>>>>> Karaf (see bold line below): >>>>>>>> >>>>>>>> START LEVEL 100 , List Threshold: 50 >>>>>>>> ID State Blueprint Spring Level Name >>>>>>>> [ 50] [Active ] [ ] [ ] [ 80] Spring >>>>>>>> Integration Core (2.1.3.RELEASE) >>>>>>>> [ 51] [Active ] [ ] [ ] [ 80] commons-dbcp >>>>>>>> (1.2.2) >>>>>>>> [ 52] [Active ] [ ] [ ] [ 80] OSGi R4 Core >>>>>>>> Bundle (4.1) >>>>>>>> [ 53] [Active ] [ ] [ ] [ 80] Spring Test >>>>>>>> (3.0.7.RELEASE) >>>>>>>> [ 54] [Active ] [ ] [ ] [ 80] c3p0 (0.9.1.2) >>>>>>>> [ 55] [Active ] [ ] [ ] [ 80] Commons IO >>>>>>>> (2.0.1) >>>>>>>> [ 56] [Active ] [ ] [ ] [ 80] aopalliance >>>>>>>> (1.0) >>>>>>>> [ 57] [Active ] [ ] [ ] [ 80] xstream (1.3) >>>>>>>> [ 58] [Active ] [ ] [ ] [ 80] Spring >>>>>>>> Expression Language (3.0.7.RELEASE) >>>>>>>> [ 59] [Active ] [ ] [ ] [ 80] Spring >>>>>>>> Context Support (3.0.7.RELEASE) >>>>>>>> [ 61] [Active ] [ ] [ ] [ 80] Spring >>>>>>>> Integration File Support (2.1.3.RELEASE) >>>>>>>> [ 62] [Resolved ] [ ] [ ] [ 80] slf4j-log4j12 >>>>>>>> (1.6.1) >>>>>>>> Hosts: 69 >>>>>>>> [ 63] [Active ] [ ] [ ] [ 80] Spring >>>>>>>> Object/XML Mapping (3.0.7.RELEASE) >>>>>>>> [ 64] [Active ] [ ] [ ] [ 80] Spring JDBC >>>>>>>> (3.0.7.RELEASE) >>>>>>>> [ 65] [Active ] [ ] [ ] [ 80] >>>>>>>> commons-collections (3.2) >>>>>>>> [ 66] [Active ] [ ] [ ] [ 80] Spring Beans >>>>>>>> (3.0.7.RELEASE) >>>>>>>> [ 67] [Active ] [ ] [ ] [ 80] Spring ASM >>>>>>>> (3.0.7.RELEASE) >>>>>>>> [ 68] [Active ] [ ] [ ] [ 80] junit (4.10) >>>>>>>> [ 69] [Active ] [ ] [ ] [ 80] slf4j-api >>>>>>>> (1.6.1) >>>>>>>> Fragments: 62 >>>>>>>> [ 70] [Active ] [ ] [ ] [ 80] jta (1.1) >>>>>>>> [ 71] [Active ] [ ] [ ] [ 80] Spring Batch >>>>>>>> Infrastructure (2.1.8.RELEASE) >>>>>>>> [ 72] [Active ] [ ] [ ] [ 80] Spring Batch >>>>>>>> Test (2.1.8.RELEASE) >>>>>>>> [ 73] [Active ] [ ] [ ] [ 80] xpp3_min >>>>>>>> (1.1.0.4c) >>>>>>>> [ 74] [Active ] [ ] [ ] [ 80] >>>>>>>> jcl-over-slf4j (1.6.1) >>>>>>>> [ 75] [Active ] [ ] [ ] [ 80] hamcrest-core >>>>>>>> (1.1) >>>>>>>> *[ 76] [Active ] [ ] [ ] [ 80] Sun >>>>>>>> Microsystems' JDBC Driver for MySQL (5.1.18)* >>>>>>>> [ 77] [Active ] [ ] [ ] [ 80] commons-pool >>>>>>>> (1.3) >>>>>>>> [ 78] [Active ] [ ] [ ] [ 80] Spring >>>>>>>> Transaction (3.0.7.RELEASE) >>>>>>>> [ 79] [Active ] [ ] [ ] [ 80] btm (2.1.2) >>>>>>>> [ 80] [Active ] [ ] [ ] [ 80] Spring Batch >>>>>>>> Integration (1.2.1.RELEASE) >>>>>>>> [ 81] [Active ] [ ] [ ] [ 80] Spring AOP >>>>>>>> (3.0.7.RELEASE) >>>>>>>> [ 82] [Active ] [ ] [ ] [ 80] Spring >>>>>>>> Context (3.0.7.RELEASE) >>>>>>>> [ 83] [Active ] [ ] [ ] [ 80] jettison (1.1) >>>>>>>> [ 84] [Active ] [ ] [ ] [ 80] Spring Core >>>>>>>> (3.0.7.RELEASE) >>>>>>>> [ 85] [Active ] [ ] [ ] [ 80] Spring Batch >>>>>>>> Core (2.1.8.RELEASE) >>>>>>>> [ 93] [Active ] [ ] [Failed ] [ 80] >>>>>>>> spring-batch-demo-trc (1.0.0.SNAPSHOT) >>>>>>>> >>>>>>>> Can anyone please help? >>>>>>>> >>>>>>>> Regards, >>>>>>>> >>>>>>>> J. >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Charles Moulliard >>>>>>> Apache Committer / Sr. Pr. Consultant at FuseSource.com >>>>>>> Twitter : @cmoulliard >>>>>>> Blog : http://cmoulliard.blogspot.com >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Charles Moulliard >>>>> Apache Committer / Sr. Pr. Consultant at FuseSource.com >>>>> Twitter : @cmoulliard >>>>> Blog : http://cmoulliard.blogspot.com >>>>> >>>>> >>>>> >>>> >>> >>> >>> -- >>> Charles Moulliard >>> Apache Committer / Sr. Pr. Consultant at FuseSource.com >>> Twitter : @cmoulliard >>> Blog : http://cmoulliard.blogspot.com >>> >>> >>> >> > > > -- > Charles Moulliard > Apache Committer / Sr. Pr. Consultant at FuseSource.com > Twitter : @cmoulliard > Blog : http://cmoulliard.blogspot.com > > >
