Update (to give more information, but it doesn't solve the issue) : Here is the bundle's MANIFEST.MF :
Manifest-Version: 1.0 Bnd-LastModified: 1461311084908 Build-Jdk: 1.7.0_95 Bundle-ManifestVersion: 2 Bundle-Name: myXMLResolver Bundle-SymbolicName: test.myXMLResolver Bundle-Version: 0.0.1.SNAPSHOT Created-By: Apache Maven Bundle Plugin Export-Package: myXMLResolver;version="0.0.1";uses:="org.apache.camel,org.apache.xerces.util" Import-Package: org.apache.camel;version="[2.16,3)",org.apache.xerces.util;version="[2.11,3)" Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.7))" Tool: Bnd-2.4.1.201501161923 If I add the package org.apache.xml.resolver in the <Import-Package>, Import-Package from MANIFEST become : org.apache.camel;version="[2.16,3)",org.apache.xerces.util;version="[2.11,3)",org.apache.xml.resolver;version="[1.2,2)" Even if the org.apache.xml.resolver is precised in <Import-Package>, and the bundle "org.apache.servicemix.bundles.xmlresolver" exports org.apache.xml.resolver, the issue is not solved. Workaround : A workaround can be done : 1. Put the bundle "org.apache.servicemix.bundles.xmlresolver" in <SMX_HOME>/lib/endorsed folder 2. In the file <SMX_HOME>/etc/config.properties, add "org.apache.xml.resolver" for the property "org.osgi.framework.system.package.extra". But it doesn't look like a clean method... Still working on it. If you have advices, don't hesitate :) Jean-Baptiste Martin Le jeu. 21 avr. 2016 à 11:57, Jean-Baptiste MARTIN <[email protected]> a écrit : > Hello, > > I've built a simple bundle which instanciate a > "org.apache.xerces.util.XMLCatalogResolver" object. > In my pom, I've had these dependencies and plugin : > > <build> > <plugins> > <!-- Plugin to create bundle --> > <plugin> > <groupId>org.apache.felix</groupId> > <artifactId>maven-bundle-plugin</artifactId> > <version>2.5.4</version> > <extensions>true</extensions> > <configuration> > <instructions> > <Import-Package>*</Import-Package> > <Export-Package>myXMLResolver</Export-Package> > </instructions> > </configuration> > </plugin> > </plugins> > </build> > <dependencies> > <dependency> > <groupId>org.apache.camel</groupId> > <artifactId>camel-core</artifactId> > <version>2.16.1</version> > <type>bundle</type> > <scope>provided</scope> > </dependency> > <!-- xerces is provided in /lib/endorsed/ folder of ServiceMix --> > <dependency> > <groupId>xerces</groupId> > <artifactId>xercesImpl</artifactId> > <version>2.11.0</version> > <scope>provided</scope> > </dependency> > <dependency> > <groupId>org.apache.servicemix.bundles</groupId> > > <artifactId>org.apache.servicemix.bundles.xmlresolver</artifactId> > <version>1.2_5</version> > <type>bundle</type> > <scope>compile</scope> > </dependency> > </dependencies> > </build> > > > Testing the bundle "locally" (within the IDE) is working fine. > Deploying it into the /deploy folder is also fine (its status is "Active"). > When running it (through Camel route), I get this stacktrace : > > Caused by: java.lang.NoClassDefFoundError: > org/apache/xml/resolver/CatalogManager > at org.apache.xerces.util.XMLCatalogResolver.init(Unknown Source)[:] > at org.apache.xerces.util.XMLCatalogResolver.<init>(Unknown Source)[:] > at org.apache.xerces.util.XMLCatalogResolver.<init>(Unknown Source)[:] > at > myXMLResolver.MainBean.run(MainBean.java:17)[241:test.myXMLResolver:0.0.1.SNAPSHOT] > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native > Method)[:1.7.0_95] > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_95] > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_95] > at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_95] > at > org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:408)[199:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:279)[199:org.apache.camel.camel-core:2.16.1] > at > org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:252)[199:org.apache.camel.camel-core:2.16.1] > ... 19 more > > > Ok, the class "CatalogManager" from package "org.apache.xml.resolver" > existed in compile-time but not in run-time. So I deploy > "org.apache.servicemix.bundles.xmlresolver" dependency into /deploy folder. > When executing in Karaf console the command "bundle:headers > <xmlresolver_bundle_id>", I get : > Export-Package = > ... > > org.apache.xml.resolver;uses:="org.apache.xml.resolver.helpers,javax.xml.parsers,org.apache.xml.resolver.readers";version=1.2, > ... > > Nevertheless, same stacktrace appears. > > Even if I add the package "org.apache.xml.resolver" in the > <Import-Package> I get the same error... > Any idea of what's going on ? > > > I'm using ServiceMix 6.1.0 (w/ Karaf 3.0.5), running on Java 7. > > > Thanks, > Jean-Baptiste Martin > >
