2 Replies Latest reply on Jun 26, 2013 2:13 AM by Jackie Li

    Jaxb 2.2.6 Slot in Jboss 7.1.1.Final with Apache Camel-Spring NPE caused by Jaxb 2.2.4

    Kevin Greene Newbie

      Hey All,

       

      The following stack trace is caused by jaxb 2.2.4 in Jboss 7.1.1.Final as known bug in jaxb 2.2.4.

      I was able to succesfully dpeloy camel-spring, camel and spring framework as module in Jboss 7.1.1.Final.

       

      I found that replace the com/sun/xml/bind/main  with 2.2.6 the problem is resolved.

      So is this a safe change to make in Jboss 7.1.1.Final?

       

      Camel-version: 2.10.3

      Spring-verison: 3.0.7

      Java 7:  1.7.0_17

       

      http://java.net/jira/browse/JAXB-860

       

      https://issues.apache.org/jira/browse/CAMEL-4955

       

      To try and work around this  issue I created a slot for jaxb 2.2.6 but this did not work I still have the following stack trace:

       

      <module xmlns="urn:jboss:module:1.1" name="com.sun.xml.bind" slot="2.2.6">

          <properties>

              <property name="jboss.api" value="private"/>

          </properties>

       

          <resources>

              <resource-root path="jaxb-impl-2.2.6.jar"/>

              <resource-root path="jaxb-xjc-2.2.6.jar"/>

              <!-- Insert resources here -->

          </resources>

       

          <dependencies>

              <module name="javax.api" />

              <module name="javax.xml.bind.api" />

              <module name="javax.xml.stream.api" />

          </dependencies>

      </module>

       

      Jboss-deployment-structure.xml

       

      <?xml version="1.0" encoding="ISO-8859-1"?>

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">

          <deployment>

              <dependencies>

                  <module name="com.sun.xml.bind" slot="2.2.6" />

                  <module name="org.apache.camel.core" />

                  <module name="org.apache.camel.spring">

                      <imports>

                          <include path="META-INF**" />

                          <include path="org**" />

                      </imports>

                  </module>

                  <module name="org.springframework">

                      <imports>

                          <include path="META-INF**" />

                          <include path="org**" />

                      </imports>

                  </module>

              </dependencies>

          </deployment>

      </jboss-deployment-structure>

       

      However, I still get the stack trace.

       

       

      10:02:45,109 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-8) Context initialization failed: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected ex
      ception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.NullPointerException
              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) [spring-context-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      
              at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467) [spring-context-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397) [spring-context-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
              at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
              at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]
              at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]
      Caused by: java.lang.NullPointerException
              at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.checkOverrideProperties(ClassBeanInfoImpl.java:205) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:186) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:528) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.property.ArrayReferenceNodeProperty.<init>(ArrayReferenceNodeProperty.java:87) [jaxb-impl-2.2.6.jar:2.2.6]
              at sun.reflect.GeneratedConstructorAccessor32.newInstance(Unknown Source) [:1.7.0_17]
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_17]
              at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_17]
              at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:128) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:181) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:168) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:528) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.property.ArrayReferenceNodeProperty.<init>(ArrayReferenceNodeProperty.java:87) [jaxb-impl-2.2.6.jar:2.2.6]
              at sun.reflect.GeneratedConstructorAccessor32.newInstance(Unknown Source) [:1.7.0_17]
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_17]
              at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_17]
              at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:128) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:181) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:528) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.property.ArrayReferenceNodeProperty.<init>(ArrayReferenceNodeProperty.java:87) [jaxb-impl-2.2.6.jar:2.2.6]
              at sun.reflect.GeneratedConstructorAccessor32.newInstance(Unknown Source) [:1.7.0_17]
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_17]
              at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_17]
              at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:128) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:181) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:168) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:528) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.<init>(SingleElementNodeProperty.java:105) [jaxb-impl-2.2.6.jar:2.2.6]
              at sun.reflect.GeneratedConstructorAccessor20.newInstance(Unknown Source) [:1.7.0_17]
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_17]
              at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_17]
              at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:128) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:181) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:528) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.<init>(ArrayElementProperty.java:112) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.<init>(ArrayElementNodeProperty.java:62) [jaxb-impl-2.2.6.jar:2.2.6]
              at sun.reflect.GeneratedConstructorAccessor31.newInstance(Unknown Source) [:1.7.0_17]
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_17]
              at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_17]
              at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:128) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:181) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:326) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:141) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1157) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:145) [jaxb-impl-2.2.6.jar:2.2.6]
              at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:236) [jaxb-impl-2.2.6.jar:2.2.6]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_17]
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_17]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_17]
              at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_17]
              at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:137) [jboss-jaxb-api_2.2_spec-1.0.3.Final.jar:1.0.3.Final]
              at javax.xml.bind.ContextFinder.find(ContextFinder.java:294) [jboss-jaxb-api_2.2_spec-1.0.3.Final.jar:1.0.3.Final]
              at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:412) [jboss-jaxb-api_2.2_spec-1.0.3.Final.jar:1.0.3.Final]
              at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:375) [jboss-jaxb-api_2.2_spec-1.0.3.Final.jar:1.0.3.Final]
              at org.apache.camel.spring.handler.CamelNamespaceHandler.createJaxbContext(CamelNamespaceHandler.java:187) [camel-spring-2.10.3.jar:2.10.3]
              at org.apache.camel.spring.handler.CamelNamespaceHandler.getJaxbContext(CamelNamespaceHandler.java:174) [camel-spring-2.10.3.jar:2.10.3]
              at org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:302) [camel-spring-2.10.3.jar:2.10.3]
              at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:85) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1338) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1328) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
      
              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
              ... 21 more
      
      
        • 1. Re: Jaxb 2.2.6 Slot in Jboss 7.1.1.Final with Apache Camel-Spring NPE caused by Jaxb 2.2.4
          Michael Haessig Newbie

          hello

          i had the same situation and a managed to fix the exception by updating the jboss module itself

          just replace all the jars with version 2.2.4  from modules\com\sun\xml\bind\main folder with a newer version, i used version 2.2.5.

          and you have to update the module.xml file

          here is my module.xml :

           

          <?xml version="1.0" encoding="UTF-8"?>

           

           

          <module xmlns="urn:jboss:module:1.1" name="com.sun.xml.bind">

              <properties>

                  <property name="jboss.api" value="private"/>

              </properties>

           

           

              <resources>

                  <resource-root path="jaxb-impl-2.2.5.jar"/>

                  <resource-root path="jaxb-xjc-2.2.5.jar"/>

                  <!-- Insert resources here -->

              </resources>

           

              <dependencies>

                  <module name="javax.api" />

                  <module name="javax.xml.bind.api" />

                  <module name="javax.xml.stream.api" />

              </dependencies>

          </module>

           

          you can download the jars from maven repository ..

           

          hope it helped

          greez miki

          • 2. Re: Jaxb 2.2.6 Slot in Jboss 7.1.1.Final with Apache Camel-Spring NPE caused by Jaxb 2.2.4
            Jackie Li Newbie

            you can override the default jaxb jar bundled within jboss 7.1. Get the desired jaxb jar, put into your application package; and exclude the jboss bundled version from jboss-deployment-structure.xml.