5 Replies Latest reply on May 6, 2018 12:55 AM by mukul4u2005

    Jboss Ear not loading classes from war file




      There is an EAR structure as:



          - abc1.war

          - abc2.war

          - lib

      lib folder containing jar file .


      abc1.war is having path WEB-INF/Classes and WEB-INF/lib folder. Classes folder having some filter classes, which are configure in web.xml as:


        <filter-name>SSO Filter</filter-name>

      com.example.SsoFilter and com.example.SessionCreator in web-inf/classes folder.


      There are some spring jars available in WEB-INF /lib folder to do jdbc call.


      After generating ear, i deployed the application on jboss 7 . Application deployed successfully but I am getting error during accessing page on login as :


      Caused by: java.lang.ClassNotFoundException: com.example.SsoFilter from [Module "deployment.test.ear:main" from Service Module Loader]

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

      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)

      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)

      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)

      at java.lang.Class.forName0(Native Method)

      at java.lang.Class.forName(Class.java:264)

      at com.db.ga.sso.client.provisional.ServiceProviderFilterImpl.createCallbackHandler(ServiceProviderFilterImpl.java:128)

      ... 41 more


      After adding this class as jar in lib folder of war its load but give another error related to spring dependency as my class is having reference of that. So it means I need to move those jars as well in Ear/lib folder.


      So my question how can i resolve this issue without moving all jars to ear/lib folder ?


      I appreciate for your response.




        • 1. Re: Jboss Ear not loading classes from war file

          Refer document link below for class loading and proper configuration

          Class Loading in WildFly - WildFly 10 - Project Documentation Editor

          • 2. Re: Jboss Ear not loading classes from war file

            I referred that, I don't want to move those jar and classes to ear/lib

            folder. It is working in weblogic but on jboss I am getting below exception.


            Please suggest.





            On Tue, Apr 17, 2018 at 3:19 AM rhn-support-rangupta

            • 3. Re: Jboss Ear not loading classes from war file

              I believe this WAR class loading  step should apply as per documentation:



              Class Loading Precedence

              A common source of errors in Java applications is including API classes in a deployment that are also provided by the container. This can result in multiple versions of the class being created and the deployment failing to deploy properly. To prevent this in WildFly, module dependencies are added in a specific order that should prevent this situation from occurring.

              In order of highest priority to lowest priority

              1. System Dependencies - These are dependencies that are added to the module automatically by the container, including the Java EE api's.
              2. User Dependencies - These are dependencies that are added through jboss-deployment-structure.xml or through the Dependencies: manifest entry.
              3. Local Resource - Class files packaged up inside the deployment itself, e.g. class files from WEB-INF/classes or WEB-INF/lib of a war.
              4. Inter deployment dependencies - These are dependencies on other deployments in an ear deployment. This can include classes in an ear's lib directory, or classes defined in other ejb jars.


              WAR Class Loading

              The war is considered to be a single module, so classes defined in WEB-INF/lib are treated the same as classes in WEB-INF/classes. All classes packaged in the war will be loaded with the same class loader.


              But ear is expecting that in test.ear/lib folder not in test.ear/abc.war/classes folder.



              • 4. Re: Jboss Ear not loading classes from war file

                Any suggestion from some one, I am getting message in server logs that subdeployment ignore the jboss-deployment descriptor file:


                ) WFLYSRV0001: /C:/jboss-eap-7.0/bin/content/abc.ear/abc.war/WEB-INF/jboss-deployment-structure.xml in subdeployment ignored. jboss-deployment-structure.xml is only parsed for top level deployments.

                • 5. Re: Jboss Ear not loading classes from war file

                  It suppose to be loaded all jars from ear/lib folder but its not picking that. We are copying those jars to lib folder of war or define that in module.


                  Any help will appreciate. Thanks