Woodstox bundle wiring issue - NoClassDefFoundError

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Woodstox bundle wiring issue - NoClassDefFoundError

alvin.kwekel
We experience a non-deterministic issue related to the bundle wiring of the Woodstox bundle.

We use a custom Camel processor that invokes exchange.getIn().getBody(DocumentSet.class). This will trigger Camel's type converter mechanism to unmarshal the body to the requested class. Woodstox is used as XML processor.

Caused by: java.lang.NoClassDefFoundError: com/ctc/wstx/sr/Attribute
        at com.ctc.wstx.sr.AttributeCollector.getNsBuilder(AttributeCollector.java:880)[208:woodstox-core-asl:4.4.1]
        at com.ctc.wstx.sr.AttributeCollector.getDefaultNsBuilder(AttributeCollector.java:868)[208:woodstox-core-asl:4.4.1]
        at com.ctc.wstx.sr.BasicStreamReader.handleNsAttrs(BasicStreamReader.java:3057)[208:woodstox-core-asl:4.4.1]
        at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:2963)[208:woodstox-core-asl:4.4.1]
        at com.ctc.wstx.sr.BasicStreamReader.handleRootElem(BasicStreamReader.java:2100)[208:woodstox-core-asl:4.4.1]
        at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2080)[208:woodstox-core-asl:4.4.1]
        at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1131)[208:woodstox-core-asl:4.4.1]
        at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:164)
        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:415)
        at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:386)
        at org.apache.camel.converter.jaxb.FallbackTypeConverter.unmarshal(FallbackTypeConverter.java:276)
        at org.apache.camel.converter.jaxb.FallbackTypeConverter.unmarshall(FallbackTypeConverter.java:181)
        at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:95)
        at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:333)
        at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:120)
        at org.apache.camel.core.osgi.OsgiTypeConverter.convertTo(OsgiTypeConverter.java:108)
        at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:72)
        at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)
        at com.example.SomeProcessor.process(SomeProcessor.java)
...
Caused by: java.lang.ClassNotFoundException: Unable to load class 'com.ctc.wstx.sr.Attribute' because the bundle wiring for woodstox-core-asl is no longer valid.

The issue will occasionally start to occur after a deployment. If the issue occurs, it will continue with each new message coming into the Camel route. If the issue doesn't occur after deployment it will not appear while running.

We have a single KAR file containing multiple features. Karaf is cleaned by removing the data folder before each deploy. After fully installing our KAR file there is only the default version 4.4.1 of Woodstox exporting package com.ctc.wstx.sr

ServiceMix 7.0.0.M2
Java 8
maven-bundle-plugin 2.4.0
features-maven-plugin 2.2.5

I have found no way to adequately reproduce the issue. I suspect the bundle start order to be of relevance.

Please help me better understand the issue. What can make the class loading fail at this point...? Could this be related to import/uses statement of the bundle...?