You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Julien Martin <ba...@gmail.com> on 2012/08/13 16:03:48 UTC

ClassNotFoundException thrown by my module

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.

Re: ClassNotFoundException thrown by my module

Posted by James Carman <jc...@carmanconsulting.com>.
I would advise against using the imports. That will tie your bundle
directly to the database vendor. If you use jndi then you have a layer of
abstraction.
On Aug 14, 2012 7:16 AM, "Julien Martin" <ba...@gmail.com> wrote:

> Thanks James,
> Your advice is interesting. I am definitely going to test this feature.
> However, what I'd really like to do now is understand how to configure the
> package Imports/Exports.
> Regards,
> J.
>
> 2012/8/14 James Carman <ja...@carmanconsulting.com>
>
>> You might try defining your data source in a simple XML file (either
>> Spring or preferably blueprint) in your deploy directory.  Then, you
>> don't have to worry about the imports.  Karaf will automatically set
>> up dynamic importing for you on any module deployed this way.  Then,
>> you just refer to your data source via JNDI (don't forget to install
>> the jndi feature).
>>
>> On Tue, Aug 14, 2012 at 4:33 AM, Julien Martin <ba...@gmail.com> wrote:
>> > Hi Ioannis,
>> > What is the exact package are you referring to?
>> > What about the odd behavior I noticed and was mentioning above?
>> > Regards,
>> > Julien.
>> >
>> >
>> >
>> > 2012/8/14 Ioannis Canellos <io...@gmail.com>
>> >>
>> >> Bitronix uses the Thread Context Class Loader in order to load the
>> driver
>> >> class, so there is no need for you to configure bitronix or
>> spring-batch to
>> >> directly import that package.
>> >>
>> >> Instead you should make sure that these mysql packages are imported by
>> the
>> >> bundle that contains the spring context and I think that it should
>> just work
>> >> (I am not 100% sure that spring set the TCCL to the current bundle,
>> but I
>> >> think that springdm does that by default).
>> >>
>> >> --
>> >> Ioannis Canellos
>> >> FuseSource
>> >>
>> >> Blog: http://iocanel.blogspot.com
>> >> Twitter: iocanel
>> >>
>> >>
>> >
>>
>
>

Re: ClassNotFoundException thrown by my module

Posted by Julien Martin <ba...@gmail.com>.
Thanks James,
Your advice is interesting. I am definitely going to test this feature.
However, what I'd really like to do now is understand how to configure the
package Imports/Exports.
Regards,
J.

2012/8/14 James Carman <ja...@carmanconsulting.com>

> You might try defining your data source in a simple XML file (either
> Spring or preferably blueprint) in your deploy directory.  Then, you
> don't have to worry about the imports.  Karaf will automatically set
> up dynamic importing for you on any module deployed this way.  Then,
> you just refer to your data source via JNDI (don't forget to install
> the jndi feature).
>
> On Tue, Aug 14, 2012 at 4:33 AM, Julien Martin <ba...@gmail.com> wrote:
> > Hi Ioannis,
> > What is the exact package are you referring to?
> > What about the odd behavior I noticed and was mentioning above?
> > Regards,
> > Julien.
> >
> >
> >
> > 2012/8/14 Ioannis Canellos <io...@gmail.com>
> >>
> >> Bitronix uses the Thread Context Class Loader in order to load the
> driver
> >> class, so there is no need for you to configure bitronix or
> spring-batch to
> >> directly import that package.
> >>
> >> Instead you should make sure that these mysql packages are imported by
> the
> >> bundle that contains the spring context and I think that it should just
> work
> >> (I am not 100% sure that spring set the TCCL to the current bundle, but
> I
> >> think that springdm does that by default).
> >>
> >> --
> >> Ioannis Canellos
> >> FuseSource
> >>
> >> Blog: http://iocanel.blogspot.com
> >> Twitter: iocanel
> >>
> >>
> >
>

Re: ClassNotFoundException thrown by my module

Posted by James Carman <ja...@carmanconsulting.com>.
You might try defining your data source in a simple XML file (either
Spring or preferably blueprint) in your deploy directory.  Then, you
don't have to worry about the imports.  Karaf will automatically set
up dynamic importing for you on any module deployed this way.  Then,
you just refer to your data source via JNDI (don't forget to install
the jndi feature).

On Tue, Aug 14, 2012 at 4:33 AM, Julien Martin <ba...@gmail.com> wrote:
> Hi Ioannis,
> What is the exact package are you referring to?
> What about the odd behavior I noticed and was mentioning above?
> Regards,
> Julien.
>
>
>
> 2012/8/14 Ioannis Canellos <io...@gmail.com>
>>
>> Bitronix uses the Thread Context Class Loader in order to load the driver
>> class, so there is no need for you to configure bitronix or spring-batch to
>> directly import that package.
>>
>> Instead you should make sure that these mysql packages are imported by the
>> bundle that contains the spring context and I think that it should just work
>> (I am not 100% sure that spring set the TCCL to the current bundle, but I
>> think that springdm does that by default).
>>
>> --
>> Ioannis Canellos
>> FuseSource
>>
>> Blog: http://iocanel.blogspot.com
>> Twitter: iocanel
>>
>>
>

Re: ClassNotFoundException thrown by my module

Posted by Julien Martin <ba...@gmail.com>.
Hi Ioannis,
What is the exact package are you referring to?
What about the odd behavior I noticed and was mentioning above?
Regards,
Julien.


2012/8/14 Ioannis Canellos <io...@gmail.com>

> Bitronix uses the Thread Context Class Loader in order to load the driver
> class, so there is no need for you to configure bitronix or spring-batch to
> directly import that package.
>
> Instead you should make sure that these mysql packages are imported by the
> bundle that contains the spring context and I think that it should just
> work (I am not 100% sure that spring set the TCCL to the current bundle,
> but I think that springdm does that by default).
>
> --
> *Ioannis Canellos*
> *
> FuseSource <http://fusesource.com>
>
> **
> Blog: http://iocanel.blogspot.com
> **
> Twitter: iocanel
> *
>
>
>

Re: ClassNotFoundException thrown by my module

Posted by Ioannis Canellos <io...@gmail.com>.
Bitronix uses the Thread Context Class Loader in order to load the driver
class, so there is no need for you to configure bitronix or spring-batch to
directly import that package.

Instead you should make sure that these mysql packages are imported by the
bundle that contains the spring context and I think that it should just
work (I am not 100% sure that spring set the TCCL to the current bundle,
but I think that springdm does that by default).

-- 
*Ioannis Canellos*
*
FuseSource <http://fusesource.com>

**
Blog: http://iocanel.blogspot.com
**
Twitter: iocanel
*

Re: ClassNotFoundException thrown by my module

Posted by Julien Martin <ba...@gmail.com>.
Hello All,
Can someone please confirm the correct syntax for importing all packages
from a  maven-bundle-plugin?
Regards,
J.

2012/8/14 Julien Martin <ba...@gmail.com>

> Hi Achim!
>
> I am really having problems with the wildcard: *
>
> For instance I want to be able to be able to export and import all package
> (for testing purposes only) using *. When I run package:import on my
> shading bundle I get this:
> *karaf@root> package:import  178*
> *spring-batch-core (178): No active imported packages.*
>
>
> *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.springframework.batch</groupId>
>  <artifactId>spring-batch-core</artifactId>
> <version>2.1.8.RELEASE</version>
>  <packaging>bundle</packaging>
> <dependencies>
> <dependency>
>  <groupId>org.springframework.batch</groupId>
> <artifactId>spring-batch-core</artifactId>
>  <version>2.1.8.RELEASE</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.springframework.batch:spring-batch-core</include>
>  </includes>
> </artifactSet>
> <filters>
>  <filter>
> <artifact>org.springframework.batch:spring-batch-core</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.springframework.batch</Bundle-SymbolicName>
>   <Export-Package>*</Export-Package>
>   <Import-Package>*</Import-Package>
>  </instructions>
>   <unpackBundle>true</unpackBundle>
>  </configuration>
> </plugin>
> </plugins>
>  </build>
>
>
> 2012/8/13 Achim Nierbeck <bc...@googlemail.com>
>
>> Hi Julien,
>>
>> well for development (and only development) you might try with dynamic
>> import.
>> The easiest way of doing is a dev:dynamic-import BUNDLEID.
>> This gives you some "dev"-time help. The imports you then see with a
>> package:imports BUNDLEID
>> will help you with creating a better import-package.
>> Besides that you still can do a <Import-Package>*</Import-Package> in
>> your POM.
>>
>> regards, Achim
>>
>> 2012/8/13 Julien Martin <ba...@gmail.com>:
>> > Is there a quick way to ask my application bundle to import all
>> packages? I
>> > tried that:
>> > <Import-Package>*</Import-Package> to no avail.
>> > J.
>> >
>> >
>> > 2012/8/13 Julien Martin <ba...@gmail.com>
>> >>
>> >> My mistake.. I am going to use what you taught me and post here
>> >> accordingly.
>> >> Thanks a lot for your time.
>> >> J.
>> >>
>> >> 2012/8/13 Charles Moulliard <ch...@gmail.com>
>> >>>
>> >>> In what you copy/paste ;-)
>> >>>
>> >>> The bundle 142 imports this package (com.mysql.jdbc.jdbc2.optional)
>> from
>> >>> the bundle 76.
>> >>>
>> >>>
>> >>>
>> >>> On Mon, Aug 13, 2012 at 6:16 PM, Julien Martin <ba...@gmail.com>
>> wrote:
>> >>>>
>> >>>> Good point Charles. I have installed spring-jms.
>> >>>>
>> >>>> Now look: I have this in my pom:
>> >>>>
>> >>>>
>> <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>
>> >>>>
>> >>>> and this in the Karaf console:
>> >>>> karaf@root> package:import 142
>> >>>> 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.sql; 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
>> >>>> Sun Microsystems' JDBC Driver for MySQL (76):
>> >>>> com.mysql.jdbc.jdbc2.optional; version=5.1.18
>> >>>> geronimo-jta_1.1_spec (117): javax.transaction.xa; version=1.1.0
>> >>>> geronimo-jta_1.1_spec (117): javax.transaction; version=1.1.0
>> >>>> geronimo-jms_1.1_spec (139): javax.jms; version=1.1.0
>> >>>> karaf@root>
>> >>>>
>> >>>> Where is the com.mysql.jdbc.jdbc2.optional package??
>> >>>> J.
>> >>>>
>> >>>> 2012/8/13 Charles Moulliard <ch...@gmail.com>
>> >>>>>
>> >>>>> Have you installed the bundle containing this package (javax.jms) ?
>> >>>>> features:install spring-jms
>> >>>>>
>> >>>>> On Mon, Aug 13, 2012 at 5:51 PM, Julien Martin <ba...@gmail.com>
>> >>>>> wrote:
>> >>>>>>
>> >>>>>> 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 <ch...@gmail.com>
>> >>>>>>>
>> >>>>>>> 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 <ba...@gmail.com>
>> >>>>>>> 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 <ch...@gmail.com>
>> >>>>>>>>>
>> >>>>>>>>> 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 <
>> balteo@gmail.com>
>> >>>>>>>>> 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 <ch...@gmail.com>
>> >>>>>>>>>>>
>> >>>>>>>>>>> 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 <
>> balteo@gmail.com>
>> >>>>>>>>>>> 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 <ch...@gmail.com>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> 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
>> >>>>>>>>>>>>> <ba...@gmail.com> 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
>> >>>>>>>
>> >>>>>>>
>> >>>>>>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> --
>> >>>>> 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
>> >>>
>> >>>
>> >>
>> >
>>
>>
>>
>> --
>>
>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
>> Committer & Project Lead
>> OPS4J Pax for Vaadin
>> <http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project
>> Lead
>> blog <http://notizblog.nierbeck.de/>
>>
>
>

Re: ClassNotFoundException thrown by my module

Posted by Julien Martin <ba...@gmail.com>.
Hi Achim!

I am really having problems with the wildcard: *

For instance I want to be able to be able to export and import all package
(for testing purposes only) using *. When I run package:import on my
shading bundle I get this:
*karaf@root> package:import  178*
*spring-batch-core (178): No active imported packages.*


*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.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
<version>2.1.8.RELEASE</version>
 <packaging>bundle</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
<version>2.1.8.RELEASE</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.springframework.batch:spring-batch-core</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>org.springframework.batch:spring-batch-core</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.springframework.batch</Bundle-SymbolicName>
  <Export-Package>*</Export-Package>
  <Import-Package>*</Import-Package>
</instructions>
  <unpackBundle>true</unpackBundle>
</configuration>
</plugin>
</plugins>
</build>


2012/8/13 Achim Nierbeck <bc...@googlemail.com>

> Hi Julien,
>
> well for development (and only development) you might try with dynamic
> import.
> The easiest way of doing is a dev:dynamic-import BUNDLEID.
> This gives you some "dev"-time help. The imports you then see with a
> package:imports BUNDLEID
> will help you with creating a better import-package.
> Besides that you still can do a <Import-Package>*</Import-Package> in your
> POM.
>
> regards, Achim
>
> 2012/8/13 Julien Martin <ba...@gmail.com>:
> > Is there a quick way to ask my application bundle to import all
> packages? I
> > tried that:
> > <Import-Package>*</Import-Package> to no avail.
> > J.
> >
> >
> > 2012/8/13 Julien Martin <ba...@gmail.com>
> >>
> >> My mistake.. I am going to use what you taught me and post here
> >> accordingly.
> >> Thanks a lot for your time.
> >> J.
> >>
> >> 2012/8/13 Charles Moulliard <ch...@gmail.com>
> >>>
> >>> In what you copy/paste ;-)
> >>>
> >>> The bundle 142 imports this package (com.mysql.jdbc.jdbc2.optional)
> from
> >>> the bundle 76.
> >>>
> >>>
> >>>
> >>> On Mon, Aug 13, 2012 at 6:16 PM, Julien Martin <ba...@gmail.com>
> wrote:
> >>>>
> >>>> Good point Charles. I have installed spring-jms.
> >>>>
> >>>> Now look: I have this in my pom:
> >>>>
> >>>>
> <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>
> >>>>
> >>>> and this in the Karaf console:
> >>>> karaf@root> package:import 142
> >>>> 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.sql; 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
> >>>> Sun Microsystems' JDBC Driver for MySQL (76):
> >>>> com.mysql.jdbc.jdbc2.optional; version=5.1.18
> >>>> geronimo-jta_1.1_spec (117): javax.transaction.xa; version=1.1.0
> >>>> geronimo-jta_1.1_spec (117): javax.transaction; version=1.1.0
> >>>> geronimo-jms_1.1_spec (139): javax.jms; version=1.1.0
> >>>> karaf@root>
> >>>>
> >>>> Where is the com.mysql.jdbc.jdbc2.optional package??
> >>>> J.
> >>>>
> >>>> 2012/8/13 Charles Moulliard <ch...@gmail.com>
> >>>>>
> >>>>> Have you installed the bundle containing this package (javax.jms) ?
> >>>>> features:install spring-jms
> >>>>>
> >>>>> On Mon, Aug 13, 2012 at 5:51 PM, Julien Martin <ba...@gmail.com>
> >>>>> wrote:
> >>>>>>
> >>>>>> 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 <ch...@gmail.com>
> >>>>>>>
> >>>>>>> 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 <ba...@gmail.com>
> >>>>>>> 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 <ch...@gmail.com>
> >>>>>>>>>
> >>>>>>>>> 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 <balteo@gmail.com
> >
> >>>>>>>>> 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 <ch...@gmail.com>
> >>>>>>>>>>>
> >>>>>>>>>>> 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 <
> balteo@gmail.com>
> >>>>>>>>>>> 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 <ch...@gmail.com>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> 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
> >>>>>>>>>>>>> <ba...@gmail.com> 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
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> 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
> >>>
> >>>
> >>
> >
>
>
>
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
> Committer & Project Lead
> OPS4J Pax for Vaadin
> <http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project
> Lead
> blog <http://notizblog.nierbeck.de/>
>

Re: ClassNotFoundException thrown by my module

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Julien,

well for development (and only development) you might try with dynamic import.
The easiest way of doing is a dev:dynamic-import BUNDLEID.
This gives you some "dev"-time help. The imports you then see with a
package:imports BUNDLEID
will help you with creating a better import-package.
Besides that you still can do a <Import-Package>*</Import-Package> in your POM.

regards, Achim

2012/8/13 Julien Martin <ba...@gmail.com>:
> Is there a quick way to ask my application bundle to import all packages? I
> tried that:
> <Import-Package>*</Import-Package> to no avail.
> J.
>
>
> 2012/8/13 Julien Martin <ba...@gmail.com>
>>
>> My mistake.. I am going to use what you taught me and post here
>> accordingly.
>> Thanks a lot for your time.
>> J.
>>
>> 2012/8/13 Charles Moulliard <ch...@gmail.com>
>>>
>>> In what you copy/paste ;-)
>>>
>>> The bundle 142 imports this package (com.mysql.jdbc.jdbc2.optional) from
>>> the bundle 76.
>>>
>>>
>>>
>>> On Mon, Aug 13, 2012 at 6:16 PM, Julien Martin <ba...@gmail.com> wrote:
>>>>
>>>> Good point Charles. I have installed spring-jms.
>>>>
>>>> Now look: I have this in my pom:
>>>>
>>>> <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>
>>>>
>>>> and this in the Karaf console:
>>>> karaf@root> package:import 142
>>>> 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.sql; 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
>>>> Sun Microsystems' JDBC Driver for MySQL (76):
>>>> com.mysql.jdbc.jdbc2.optional; version=5.1.18
>>>> geronimo-jta_1.1_spec (117): javax.transaction.xa; version=1.1.0
>>>> geronimo-jta_1.1_spec (117): javax.transaction; version=1.1.0
>>>> geronimo-jms_1.1_spec (139): javax.jms; version=1.1.0
>>>> karaf@root>
>>>>
>>>> Where is the com.mysql.jdbc.jdbc2.optional package??
>>>> J.
>>>>
>>>> 2012/8/13 Charles Moulliard <ch...@gmail.com>
>>>>>
>>>>> Have you installed the bundle containing this package (javax.jms) ?
>>>>> features:install spring-jms
>>>>>
>>>>> On Mon, Aug 13, 2012 at 5:51 PM, Julien Martin <ba...@gmail.com>
>>>>> wrote:
>>>>>>
>>>>>> 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 <ch...@gmail.com>
>>>>>>>
>>>>>>> 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 <ba...@gmail.com>
>>>>>>> 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 <ch...@gmail.com>
>>>>>>>>>
>>>>>>>>> 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 <ba...@gmail.com>
>>>>>>>>> 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 <ch...@gmail.com>
>>>>>>>>>>>
>>>>>>>>>>> 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 <ba...@gmail.com>
>>>>>>>>>>> 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 <ch...@gmail.com>
>>>>>>>>>>>>>
>>>>>>>>>>>>> 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
>>>>>>>>>>>>> <ba...@gmail.com> 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
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 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
>>>
>>>
>>
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
OPS4J Pax for Vaadin
<http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project
Lead
blog <http://notizblog.nierbeck.de/>

Re: ClassNotFoundException thrown by my module

Posted by Julien Martin <ba...@gmail.com>.
Is there a quick way to ask my application bundle to import all packages? I
tried that:
<Import-Package>*</Import-Package> to no avail.
J.

2012/8/13 Julien Martin <ba...@gmail.com>

> My mistake.. I am going to use what you taught me and post here
> accordingly.
> Thanks a lot for your time.
> J.
>
> 2012/8/13 Charles Moulliard <ch...@gmail.com>
>
>> In what you copy/paste ;-)
>>
>> The bundle 142 imports this package (com.mysql.jdbc.jdbc2.optional) from
>> the bundle 76.
>>
>>
>>
>> On Mon, Aug 13, 2012 at 6:16 PM, Julien Martin <ba...@gmail.com> wrote:
>>
>>> Good point Charles. I have installed spring-jms.
>>>
>>> *Now look: I have this in my pom: *
>>>
>>> <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>
>>>
>>> *and this in the Karaf console:*
>>> karaf@root> package:import 142
>>> 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.sql; 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
>>> Sun Microsystems' JDBC Driver for MySQL (76):
>>> com.mysql.jdbc.jdbc2.optional; version=5.1.18
>>> geronimo-jta_1.1_spec (117): javax.transaction.xa; version=1.1.0
>>> geronimo-jta_1.1_spec (117): javax.transaction; version=1.1.0
>>> geronimo-jms_1.1_spec (139): javax.jms; version=1.1.0
>>> karaf@root>
>>>
>>> Where is the* com.mysql.jdbc.jdbc2.optional *package??
>>> J.
>>>
>>> 2012/8/13 Charles Moulliard <ch...@gmail.com>
>>>
>>>> Have you installed the bundle containing this package (*javax.jms) ? *
>>>> *features:install spring-jms
>>>> *
>>>>
>>>> On Mon, Aug 13, 2012 at 5:51 PM, Julien Martin <ba...@gmail.com>wrote:
>>>>
>>>>> 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 <ch...@gmail.com>
>>>>>
>>>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>>>
>>>>>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>>>>>
>>>>>>>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>>>>>>>
>>>>>>>>>>>> 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 <
>>>>>>>>>>>> balteo@gmail.com> 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
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> 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
>>
>>
>>
>

Re: ClassNotFoundException thrown by my module

Posted by Julien Martin <ba...@gmail.com>.
My mistake.. I am going to use what you taught me and post here accordingly.
Thanks a lot for your time.
J.

2012/8/13 Charles Moulliard <ch...@gmail.com>

> In what you copy/paste ;-)
>
> The bundle 142 imports this package (com.mysql.jdbc.jdbc2.optional) from
> the bundle 76.
>
>
>
> On Mon, Aug 13, 2012 at 6:16 PM, Julien Martin <ba...@gmail.com> wrote:
>
>> Good point Charles. I have installed spring-jms.
>>
>> *Now look: I have this in my pom: *
>>
>> <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>
>>
>> *and this in the Karaf console:*
>> karaf@root> package:import 142
>> 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.sql; 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
>> Sun Microsystems' JDBC Driver for MySQL (76):
>> com.mysql.jdbc.jdbc2.optional; version=5.1.18
>> geronimo-jta_1.1_spec (117): javax.transaction.xa; version=1.1.0
>> geronimo-jta_1.1_spec (117): javax.transaction; version=1.1.0
>> geronimo-jms_1.1_spec (139): javax.jms; version=1.1.0
>> karaf@root>
>>
>> Where is the* com.mysql.jdbc.jdbc2.optional *package??
>> J.
>>
>> 2012/8/13 Charles Moulliard <ch...@gmail.com>
>>
>>> Have you installed the bundle containing this package (*javax.jms) ? *
>>> *features:install spring-jms
>>> *
>>>
>>> On Mon, Aug 13, 2012 at 5:51 PM, Julien Martin <ba...@gmail.com> wrote:
>>>
>>>> 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 <ch...@gmail.com>
>>>>
>>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>>
>>>>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>>>>
>>>>>>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>>>>>>
>>>>>>>>>>> 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 <balteo@gmail.com
>>>>>>>>>>> > 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
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> 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
>
>
>

Re: ClassNotFoundException thrown by my module

Posted by Charles Moulliard <ch...@gmail.com>.
In what you copy/paste ;-)

The bundle 142 imports this package (com.mysql.jdbc.jdbc2.optional) from
the bundle 76.



On Mon, Aug 13, 2012 at 6:16 PM, Julien Martin <ba...@gmail.com> wrote:

> Good point Charles. I have installed spring-jms.
>
> *Now look: I have this in my pom: *
>
> <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>
>
> *and this in the Karaf console:*
> karaf@root> package:import 142
> 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.sql; 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
> Sun Microsystems' JDBC Driver for MySQL (76):
> com.mysql.jdbc.jdbc2.optional; version=5.1.18
> geronimo-jta_1.1_spec (117): javax.transaction.xa; version=1.1.0
> geronimo-jta_1.1_spec (117): javax.transaction; version=1.1.0
> geronimo-jms_1.1_spec (139): javax.jms; version=1.1.0
> karaf@root>
>
> Where is the* com.mysql.jdbc.jdbc2.optional *package??
> J.
>
> 2012/8/13 Charles Moulliard <ch...@gmail.com>
>
>> Have you installed the bundle containing this package (*javax.jms) ? *
>> *features:install spring-jms
>> *
>>
>> On Mon, Aug 13, 2012 at 5:51 PM, Julien Martin <ba...@gmail.com> wrote:
>>
>>> 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 <ch...@gmail.com>
>>>
>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>
>>>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>>>
>>>>>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>>>>>
>>>>>>>>>> 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 <ba...@gmail.com>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
>>>>
>>>>
>>>>
>>>
>>
>>
>> --
>> 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

Re: ClassNotFoundException thrown by my module

Posted by Julien Martin <ba...@gmail.com>.
Good point Charles. I have installed spring-jms.

*Now look: I have this in my pom: *
<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>

*and this in the Karaf console:*
karaf@root> package:import 142
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.sql; 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
Sun Microsystems' JDBC Driver for MySQL (76):
com.mysql.jdbc.jdbc2.optional; version=5.1.18
geronimo-jta_1.1_spec (117): javax.transaction.xa; version=1.1.0
geronimo-jta_1.1_spec (117): javax.transaction; version=1.1.0
geronimo-jms_1.1_spec (139): javax.jms; version=1.1.0
karaf@root>

Where is the* com.mysql.jdbc.jdbc2.optional *package??
J.

2012/8/13 Charles Moulliard <ch...@gmail.com>

> Have you installed the bundle containing this package (*javax.jms) ? *
> *features:install spring-jms
> *
>
> On Mon, Aug 13, 2012 at 5:51 PM, Julien Martin <ba...@gmail.com> wrote:
>
>> 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 <ch...@gmail.com>
>>
>>> 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 <ba...@gmail.com> 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 <ch...@gmail.com>
>>>>
>>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>>
>>>>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>>>>
>>>>>>>>> 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 <ba...@gmail.com>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
>>>
>>>
>>>
>>
>
>
> --
> Charles Moulliard
> Apache Committer / Sr. Pr. Consultant at FuseSource.com
> Twitter : @cmoulliard
> Blog : http://cmoulliard.blogspot.com
>
>
>

Re: ClassNotFoundException thrown by my module

Posted by Charles Moulliard <ch...@gmail.com>.
Have you installed the bundle containing this package (*javax.jms) ? *
*features:install spring-jms
*
On Mon, Aug 13, 2012 at 5:51 PM, Julien Martin <ba...@gmail.com> wrote:

> 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 <ch...@gmail.com>
>
>> 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 <ba...@gmail.com> 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 <ch...@gmail.com>
>>>
>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>
>>>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>>>
>>>>>>>> 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 <ba...@gmail.com>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
>>
>>
>>
>


-- 
Charles Moulliard
Apache Committer / Sr. Pr. Consultant at FuseSource.com
Twitter : @cmoulliard
Blog : http://cmoulliard.blogspot.com

Re: ClassNotFoundException thrown by my module

Posted by Julien Martin <ba...@gmail.com>.
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 <ch...@gmail.com>

> 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 <ba...@gmail.com> 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 <ch...@gmail.com>
>>
>>> 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 <ba...@gmail.com> 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 <ch...@gmail.com>
>>>>
>>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>>
>>>>>>> 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 <ba...@gmail.com>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
>
>
>

Re: ClassNotFoundException thrown by my module

Posted by Charles Moulliard <ch...@gmail.com>.
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 <ba...@gmail.com> 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 <ch...@gmail.com>
>
>> 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 <ba...@gmail.com> 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 <ch...@gmail.com>
>>>
>>>> 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 <ba...@gmail.com>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 <ch...@gmail.com>
>>>>>
>>>>>> 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 <ba...@gmail.com>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

Re: ClassNotFoundException thrown by my module

Posted by Julien Martin <ba...@gmail.com>.
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 <ch...@gmail.com>

> 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 <ba...@gmail.com> 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 <ch...@gmail.com>
>>
>>> 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 <ba...@gmail.com> 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 <ch...@gmail.com>
>>>>
>>>>> 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 <ba...@gmail.com>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
>
>
>

Re: ClassNotFoundException thrown by my module

Posted by Charles Moulliard <ch...@gmail.com>.
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 <ba...@gmail.com> 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 <ch...@gmail.com>
>
>> 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 <ba...@gmail.com> 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 <ch...@gmail.com>
>>>
>>>> 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 <ba...@gmail.com>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

Re: ClassNotFoundException thrown by my module

Posted by Julien Martin <ba...@gmail.com>.
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 <ch...@gmail.com>

> 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 <ba...@gmail.com> 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 <ch...@gmail.com>
>>
>>> 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 <ba...@gmail.com> 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
>
>
>

Re: ClassNotFoundException thrown by my module

Posted by Charles Moulliard <ch...@gmail.com>.
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 <ba...@gmail.com> 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 <ch...@gmail.com>
>
>> 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 <ba...@gmail.com> 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

Re: ClassNotFoundException thrown by my module

Posted by Julien Martin <ba...@gmail.com>.
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 <ch...@gmail.com>

> 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 <ba...@gmail.com> 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
>
>
>

Re: ClassNotFoundException thrown by my module

Posted by Charles Moulliard <ch...@gmail.com>.
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 <ba...@gmail.com> 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