1 Reply Latest reply on Jun 8, 2016 8:39 AM by Prabahar Duraisamy

    Code migration from EAP 5 to EAP 7

    Prabahar Duraisamy Newbie

      I am migrating application code from JBoss EAP 5 to EAP 7. I have an issue while deploying my EAR, complaining about JAXB loading

       

      Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 189 counts of IllegalAnnotationExceptions

      com.xxx.xml.v4.RequestResponseDocument is an interface, and JAXB can't handle interfaces.

       

      This code is using XMLBeans for marshalling and unmarshalling between object and XML document (request / response) structure. I made sure the is no dependency (JAXB reference or implementation) in my pom file while building and there is no such jar files in the ear build. However, when I deploy the application, I can see the above exception.

       

      jboss-deployment-structure

      ======================

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

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

         

          <!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->

            <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

           

            <!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->

            <!-- This is the top level ear module, which contains all the classes in the EAR's lib folder     -->

          <deployment>

             

              <dependencies>

                  <module name="org.apache.activemq" />

              </dependencies>

             

              <!-- exclude-subsystem prevents a subsystems deployment unit processors running on a deployment -->

               <!-- which gives basically the same effect as removing the subsystem, but it only affects single deployment -->

              <exclude-subsystems>

                  <subsystem name="jaxrs" />

                  <subsystem name="resteasy" />

              </exclude-subsystems>

             

              <!-- Exclusions allow you to prevent the server from automatically adding some dependencies     -->

              <exclusions>

                 <!-- Exclude Version cxf of JBOSS -->

                 <module name="org.apache.cxf" />

                 <module name="javaee.api" />

       

                 <!-- Exclude RestEasy conflict (javax.ws.rs.ext.RunDelegate) -->

                 <module name="org.jboss.resteasy.resteasy-jackson-provider" />

                 <module name="org.jboss.as.jaxrs"/>

                 <module name="org.jboss.resteasy.resteasy-jaxrs"/>

                 <module name="org.jboss.resteasy.resteasy-cdi"/>

                 <module name="org.jboss.resteasy.jackson-provider"/>

                 <module name="org.jboss.resteasy.resteasy-atom-provider"/>

                 <module name="org.jboss.resteasy.resteasy-hibernatevalidator-provider"/>

                 <module name="org.jboss.resteasy.resteasy-jaxb-provider"/>

                 <module name="org.jboss.resteasy.resteasy-jettison-provider"/>

                 <module name="org.jboss.resteasy.resteasy-jsapi"/>

                 <module name="org.jboss.resteasy.resteasy-multipart-provider"/>

                 <module name="org.jboss.resteasy.resteasy-yaml-provider"/>

                 <module name="org.codehaus.jackson.jackson-core-asl"/>

                 <module name="org.codehaus.jackson.jackson-jaxrs"/>

                 <module name="org.codehaus.jackson.jackson-mapper-asl"/>

                 <module name="org.codehaus.jackson.jackson-xc"/>

                 <module name="org.codehaus.jettison"/>

                 <module name="javax.ws.rs.api"/>

              </exclusions>       

          </deployment>

      </jboss-deployment-structure>

       

      Additional information that I made in module config

       

      I have added the path

      system\layers\base\org\xmlbeans\main

       

      under this path I have 3 files:

      - 'xbean-2.4.0.jar'

       

      - pom:

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

      <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <modelVersion>4.0.0</modelVersion>

        <groupId>org.xmlbeans</groupId>

        <artifactId>xbean</artifactId>

        <version>2.4.0</version>

        <description>Artifactory auto generated POM</description>

      </project>

       

      - module.xml

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

      <module xmlns="urn:jboss:module:1.0" name="org.xmlbeans">

        <resources>

          <resource-root path="xbean-2.4.0.jar"/>

              <!-- Insert resources here -->

        </resources>

        </module>

       

      Exception is talking about classes that got generated using XMLBean doesn't have the proper annotation hence its unable to process. But I don't want JAXB to process it, rather it should be XMLBeans which is included along with the build library.

      Does EAP 7 only supports JAXB not XMLBeans? Please share your thoughts, thanks!

       

      Exception stack trace

      ------------------------------------

      2016-06-07 13:02:55,931 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.subunit."xxx-app-01.04.86.ear"."xxx-ie-01.04.86.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."xxx-app-01.04.86.ear"."xxx-ie-01.04.86.jar".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of subdeployment "xxx-ie-01.04.86.jar" of deployment "xxx-app-01.04.86.ear"

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

          at java.lang.Thread.run(Thread.java:745)

      Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException

          at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375)

          at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.doPublish(EndpointImpl.java:79)

          at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255)

          at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:543)

          at org.jboss.wsf.stack.cxf.configuration.BusHolder.configure(BusHolder.java:234)

          at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:97)

          at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:59)

          at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:73)

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)

          ... 5 more

      Caused by: org.apache.cxf.service.factory.ServiceConstructionException

          at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:329)

          at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)

          at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:467)

          at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:696)

          at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:527)

          at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:261)

          at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199)

          at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)

          at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:168)

          at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)

          at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:460)

          at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:338)

          ... 13 more

      Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 189 counts of IllegalAnnotationExceptions

      com.xxx.xml.v4.RequestResponseDocument is an interface, and JAXB can't handle interfaces.

          this problem is related to the following location:

              at com.xxx.xml.v4.RequestResponseDocument

              at private com.xxx.xml.v4.RequestResponseDocument com.xxx.ie.ws.impl.jaxws_asm.GetXxxRequestResponseDocumentResponse._return

              at com.xxx.ie.ws.impl.jaxws_asm.GetXxxRequestResponseDocumentResponse

      com.xxx.xml.v4.RequestResponseDocument$XxxRequestResponse is an interface, and JAXB can't handle interfaces.

          this problem is related to the following location:

        • 1. Re: Code migration from EAP 5 to EAP 7
          Prabahar Duraisamy Newbie

          1. added xmlbeans to the module

          2. in the module.xml add the below

           

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

          <module xmlns="urn:jboss:module:1.0" name="org.xmlbeans">

            <resources>

              <resource-root path="xbean-2.4.0.jar"/>

                  <!-- Insert resources here -->

            </resources>

            <dependencies>

              <module name="javax.api" />

            </dependencies>

          </module>

           

          3. go to cxf main module.xml edit it by adding the below dependencies module

           

                  <!-- Added for XMLBean so that CXF uses XMLBean -->

                  <module name="org.xmlbeans" />

           

          4. Download cxf-rt-databinding-xmlbeans-3.1.4.jar and place it under modules\system\layers\base\org\apache\cxf\impl\main

           

          5. Update module.xml under modules\system\layers\base\org\apache\cxf\impl\main for the new add resource

                      <resource-root path="cxf-rt-databinding-xmlbeans-3.1.4.jar"/>

           

          6. in EAR jboss-deployment-structure.xml add the following dependencies

                      <module name="org.xmlbeans" services="export" />

                      <module name="org.jboss.ws.cxf.jbossws-cxf-client" services="export" />

           

           

          However, I am still getting the same JAXB loading issue. So I tried to comment the <!-- <resource-root path="cxf-rt-databinding-jaxb-3.1.4.jar"/> --> in the cxf-impl so it can load the newly added xmlbeans. When I do so it is complain about missing class

          Caused by: java.lang.ClassNotFoundException: org.apache.cxf.jaxb.JAXBDataBinding from [Module "org.apache.cxf.impl:main" from local module loader @33e5ccce (finder: local module finder @5a42bbf4 (roots: C:\Prabahar\dev\wildfly-10.0.0.Final\modules,C:\Prabahar\dev\wildfly-10.0.0.Final\modules\system\layers\base))]

              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)

           

          Please suggest a way to overcome this issue, thanks!