5 Replies Latest reply on Nov 22, 2012 12:26 PM by chandrup

    Strange Classloading in JBoss 7.1.1.Final

    Sueleyman Vurucu Expert

      Hi guys,

       

      for make my deployment shrinker I swapped my 3rd party libs as a jboss moulde. That saves in mycase 40 MB for my deployment.

       

      In my ear I denfined a jboss-deployment-structure.xml which located in myEar/META-INF with this content:

       

      <jboss-deployment-structure>
      <!-- 
      <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
      -->
      
          <deployment>
              <dependencies>
                  <module name="my.company.module" slot="main" />
                  <module name="org.drools" slot="main" />
                  <module name="org.hibernate" slot="main" />
              </dependencies>
          </deployment>
      </jboss-deployment-structure>
      

       

       

      In this case I get a ClassNotFoundExcpetion.

       

      If I add the module entry to standalone.xml as shown below than it's works??

       

       

      <subsystem xmlns="urn:jboss:domain:ee:1.0">
                  <global-modules>
                  <  <module name="my.company.module" slot="main" />
                  </global-modules>
              </subsystem>
      

       

       

      Did I miss something??

        • 1. Re: Strange Classloading in JBoss 7.1.1.Final
          Jay SenSharma Master

          For EAR files you need to inject the module dependency at the "sub-deployment" level as following:

           

           

          <jboss-deployment-structure>
              <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
              <deployment>
                <dependencies>   
                  <module name="my.company.module" />
                </dependencies>
              </deployment>
          
              <sub-deployment name="Test-Web.war">
                  <dependencies>           
                      <module name="my.company.module" />
                  </dependencies>
              </sub-deployment>
          
              <sub-deployment name="Test-ejb.jar">
                  <dependencies>           
                      <module name="my.company.module" />
                  </dependencies>
              </sub-deployment>
          </jboss-deployment-structure>
          
          • 2. Re: Strange Classloading in JBoss 7.1.1.Final
            Sueleyman Vurucu Expert

            Is for this approach <ear-subdeployments-isolated>false</ear-subdeployments-isolated> mandatory ??

             

            If yes I muss declare my module as global. Beacause of JMS I can't use isolated classloading.

            • 3. Re: Strange Classloading in JBoss 7.1.1.Final
              Jay SenSharma Master

              Hi,

               

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

               

               

              By default the "EAR/lib" directory is a single module, and every WAR or EJB jar deployment is also a separate module. Sub deployments (wars and ejb-jars) always

              have a dependency on the parent module, which gives them access to classes in EAR/lib, however they do not always have an automatic dependency on each other.

              This behaviour is controlled via the ear-subdeployments-isolated setting in the ee subsystem configuration: 

               

              <subsystem xmlns="urn:jboss:domain:ee:1.0" >

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

              </subsystem>

               

               

              Or you can set it in "jboss-deployment-structure.xml" as

               

              <jboss-deployment-structure>
                  <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

              .

              .

              <jboss-deployment-structure>

               

               

                  You can set it to true if you want the modules present inside your EAR should have see each other's classes/

              • 4. Re: Strange Classloading in JBoss 7.1.1.Final
                Sueleyman Vurucu Expert

                Ok,

                then İ misunderstood the  <ear-subdeployments-isolated>false</ear-subdeployments-isolated> section.

                 

                I think the easiest way for me is define my jboss module in standalone.xml as a global module.

                 

                Thanks

                • 5. Re: Strange Classloading in JBoss 7.1.1.Final
                  Newbie

                  <jboss-deployment-structure>
                      <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
                      <deployment>
                        <dependencies>   
                          <module name="my.company.module" />
                        </dependencies>
                      </deployment>
                  
                      <sub-deployment name="Test-Web.war">
                          <dependencies>           
                              <module name="my.company.module" />
                          </dependencies>
                      </sub-deployment>
                  
                      <sub-deployment name="Test-ejb.jar">
                          <dependencies>           
                              <module name="my.company.module" />
                          </dependencies>
                      </sub-deployment>
                  </jboss-deployment-structure>
                  

                   

                  In the above section, what is the significance of <module> tag and on what basis we give name to a module