You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Lennart Jorelid <lj...@jguru.se> on 2011/09/26 15:53:33 UTC
JAXB bug and Camel interaction
Hello all,
As some of you might have realized awhile ago, the JAXB implementation
causes interesting problems for those of you using spring to read
camel contexts. There are actually 2 errors with similar error output,
so this mail aims to reduce confusion for us all.
Error description: You receive a stacktrace with an inner exception
on the form below.
Caused by: java.lang.NullPointerException
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.checkOverrideProperties(ClassBeanInfoImpl.java:205)
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:186)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:528)
at com.sun.xml.bind.v2.runtime.property.ArrayReferenceNodeProperty.<init>(ArrayReferenceNodeProperty.java:87)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[ ... and a looong intermediary stack trace removed ... The stacktrace ends with: ]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:128)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:277)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
at org.apache.camel.spring.handler.CamelNamespaceHandler.createJaxbContext(CamelNamespaceHandler.java:185) <===
at org.apache.camel.spring.handler.CamelNamespaceHandler.getJaxbContext(CamelNamespaceHandler.java:172)
at org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:300)
Note that the exception originates from the CamelNamespaceHandler.
There are 2 quite separate causes for this exception.
a) You use different JAXB-API and JAXB-IMPL versions,
which is *bad*. Fix this problem by managing your
dependencies correctly.
b) You use correct/same JAXB-API and JAXB-IMPL versions,
and the problem persists. This is actually a combination
of a rather interesting implementation in JAXB and our own
class org.apache.camel.model.InterceptDefinition which does
not contain any non-transient XML elements or attributes.
The bug is known in JAXB, and corrected in their trunk in June.
However, there is currently neither a release nor a snapshot
containing the (somewhat strange) fix for the bug.
Unfortunately, fellow Camel'ers, I have found no current solution
other than downloading the source and building a custom release
of Jaxb. The reference in Jaxb is http://java.net/jira/browse/JAXB-860
and a fix permitting you to see the problems/culprits is found
below.
- for (Property superProperty : bi.properties) {
+ Property[] props = bi.properties;
+ if (props == null) {
+ logger.log(Level.WARNING, "Comsumed Jaxb error (no Properties) for type '" + bi.jaxbType +"'");
+ break;
+ }
+ for (Property superProperty : props) {
--
+==============================+
| Bästa hälsningar,
| [sw. "Best regards"]
|
| Lennart Jörelid
| EAI Architect & Integrator
| jGuru Europe AB
+==============================+