1 Reply Latest reply on Apr 24, 2013 12:09 PM by Wolf-Dieter Fink

    Class loader sequence issue for Web and Ejb project in EAP5.1

    Cave Bryan Newbie

      Hi All,


      We are using JBoss EAP 5.1 for our project. And we met class loading issue when deploy ejb + war into EAP.


      We try to deploy a web project, an ejb project, a Java project (business module) and a Java project(utility classes) into JBoss.

      EJB calls business module and utility module, and war calls ejb.


      Previously the ejb project and 2 java projects are built into one ear and we put the ejb.jar, business.jar and util.jar into the lib folder of web project. After that ear & war are deployed in other application(i.e. weblogic) and it works well.


      Now we try to build ejb, business and utility into an ear, then deploy it to EAP 5.1. It works. But when we deploy the war into JBoss class loading sequence error occurs. Needed jar exist in WEB-INF/lib but war fail to load it.


      We have to add below into  jboss-web.xml in the war


      <class-loading java2ClassLoadingCompliance="true"></class-loading>


      and copy all of the jar in WEB-INF/lib of war into JBOSS_SERVER/server/default/lib, then the web project runs correctly.


      Here is the question:


      Why we need to ask parent class loader to load class for web project?


      The jars in lib folder of war should be loaded by the war itself, we tried to deploy the ejb into the ear, or outside the ear with war, or just put all of them into the ear, all of them fails (if don't set java2ClassLoadingCompliance="true").


      What is the correct class loader sequence and how to develop correctly for this kind of project? We don't want to copy all of the jars of war into JBoss server lib folder.