1 Reply Latest reply on Sep 29, 2017 5:45 AM by Med Alpa

    Jboss EAP 6.4.4 Class Loading problem

    Med Alpa Newbie



      I try to deploy a web application on jboss 6.4.4.


      The ear file contains Jaxb jars.


      When invoking a web service there is a problem with xml binding :


      ClassCastException: attempting to cast vfs:/content/App.ear/jaxb-api-2.1.jar/javax/xml/bind/JAXBContext.class

      to jar:__file:/home/myworkingfolder/jboss-eap-6.4.4/modules/system/layers/base/javax/xml/bind/api/main/jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-3.jar!/javax/xml/bind/JAXBContext.class. 

      Please make sure that you are specifying the proper ClassLoader.


      How to exclude the jboss jaxb lib?



        • 1. Re: Jboss EAP 6.4.4 Class Loading problem
          Med Alpa Newbie

          The jar jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-3.jar is included within the module "javax.xml.bind.api".


          1- I tried in the begining by excluding this module in the jboss-deployment-structure.xml file.


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


          The module was not excluded even with this explicit exclusion.

          This module was loaded implicitly by the javaee module.


          2- So I tried to exclude the javaee module and put its module.xml content within the jboss-deployment-structure.xml without the javax.xml.bind.api module



          <module name="javaee.api"/>



          <module name="javax.activation.api" export="true"/>

          <module name="javax.annotation.api" export="true"/>

          <module name="javax.ejb.api" export="true"/>

          <module name="javax.el.api" export="true"/>

          <module name="javax.enterprise.api" export="true"/>

          <module name="javax.enterprise.deploy.api" export="true"/>

          <module name="javax.inject.api" export="true"/>

          <module name="javax.interceptor.api" export="true"/>

          <module name="javax.jms.api" export="true"/>

          <module name="javax.jws.api" export="true"/>

          <module name="javax.mail.api" export="true"/>

          <module name="javax.management.j2ee.api" export="true"/>

          <module name="javax.persistence.api" export="true"/>

          <module name="javax.resource.api" export="true"/>

          <module name="javax.rmi.api" export="true"/>

          <module name="javax.security.auth.message.api" export="true"/>

          <module name="javax.security.jacc.api" export="true"/>

          <module name="javax.servlet.api" export="true"/>

          <module name="javax.servlet.jsp.api" export="true"/>

          <module name="javax.transaction.api" export="true"/>

          <module name="javax.validation.api" export="true"/>

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

          <!-- <module name="javax.xml.bind.api" export="true"/> -->

          <module name="javax.xml.registry.api" export="true"/>

          <module name="javax.xml.soap.api" export="true"/>

          <module name="javax.xml.ws.api" export="true"/>


          <!-- This one always goes last. -->

          <module name="javax.api" export="true"/>



          This method exclude the javax.xml.bind.api.


          But I encoutered this error :


          Caused by: java.lang.NoClassDefFoundError: org/apache/cxf/frontend/ClientProxy


          I resolved this error by adding cxf in the dependencies:


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

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


                  <include path="META-INF"/>

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




          The jboss-deployment-structure.xml become very verbose...