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

Reply via email to