camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lennart Jorelid>
Subject JAXB bug and Camel interaction
Date Mon, 26 Sep 2011 13:53:33 GMT
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(
	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        [ ... and a looong intermediary stack trace removed ... The stacktrace ends with:

	at javax.xml.bind.ContextFinder.newInstance(
	at javax.xml.bind.ContextFinder.find(
	at javax.xml.bind.JAXBContext.newInstance(
	at javax.xml.bind.JAXBContext.newInstance(
	at org.apache.camel.spring.handler.CamelNamespaceHandler.createJaxbContext(
	at org.apache.camel.spring.handler.CamelNamespaceHandler.getJaxbContext(
	at org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(

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
   and a fix permitting you to see the problems/culprits is found

-            for (Property superProperty : {
+            Property[] props =;
+            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

View raw message