19 junho 2012

Issue with JBoss and Camel

If you are like me and are trying to run Apache Camel on JBoss 7.1.1, you may face an issue related to this exception:
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
This happens because there's a bug on JAXB 2.2.4, the version used by default on JBoss 7.1.1.
I honestly don't know if this also happens to any other JBoss 7 versions, but this is a bug only with JAXB 2.2.4, so if the version you have has this JAXB version, you also have this problem.

To fix this, follow these instructions:

  1. Download the new version of JAXB (from Maven Repo)
    1. jaxb-impl-2.2.5-2
    2. jaxb-xjc-2.2.5-2
  2. Put these files on this JBoss folder:
    1. jboss-as-7.1.1.Final/modules/com/sun/xml/bind/main
  3. Open the file module.xml
    1. replace the old version (2.2.4) with the new one (2.2.5-2)
  4. Done!
Now get back to work!

PS: part of this solution (updating JAXB) is thanks to this thread.
Postar um comentário


LinkedIn: www.linkedin.com/in/brunocborges
Twitter: www.twitter.com/brunoborges
Comprei e Não Vou
Rio de Janeiro, RJ Brasil
São Paulo, SP Brasil