3 Replies Latest reply on Jun 5, 2012 10:51 AM by raydecampo

    Dependency on commons-lang module not recognized

    raydecampo

      I am using tomahawk in my application which introduces a dependency on commons-lang.  Since I wasn't referencing commons-lang directly, I figured I would just use the module packaged with JBoss via jboss-deployment-structure.xml:

      <jboss-deployment-structure>

           <deployment>

               <dependencies>

                   <module name="org.apache.commons.lang" />

                   <module name="org.javassist" />

                   <module name="org.hibernate" />

               </dependencies>

           </deployment>

      </jboss-deployment-structure>

       

      For some reason this failed to resolve the dependency, i.e. I still get a ClassNotFoundException for org.apache.commons.lang.StringUtils.  I am reasonably confident that my jboss-deployment-structure.xml is recognized as I have no problems with Hibernate.  The jboss-deployment-structure.xml file is in the META-INF directory of my EAR while tomahawk is in WEB-INF/lib directory of a WAR inside the EAR.

       

      I'm probably missing something obvious, thanks in advance.  BTW, what's the easiest way to copy XML into the editor for this forum? I went into HTML mode to get the <code> tags but then I had to escape all the angle brackets.  (I'm also not really digging the lack of a preview.)

        • 1. Re: Dependency on commons-lang module not recognized
          ctomc

          Hi,

           

          you have to expose dependancies also for submodules, that is in your case, the war.

          take a look at https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7

           

          look at the EAR class loading part and full blown example of jboss-deployment-structure.xml

           

          as for code fragments on forum, on the right of the editor there is "use advanced editor" which has all the "extra" functions

           

           

          --

          tomaz

          • 2. Re: Dependency on commons-lang module not recognized
            jaikiran

            Tomaz Cerar wrote:

             

             

            as for code fragments on forum, on the right of the editor there is "use advanced editor" which has all the "extra" functions

             

             

            Actually, while creating a new topic the user is already in advanced editor mode. However, I do agree that the code formatting icon isn't that recognizable. Ray, it's the >> icon/button in the editor window which you have to click, to see the options available for formatting.

            • 3. Re: Dependency on commons-lang module not recognized
              raydecampo

              OK, so I was able resolve the dependcy by using the following:

               

              <sub-deployment name="sc.war">
                   <dependencies>
                        <module name="org.apache.commons.lang" />
                   </dependencies>
              </sub-deployment>
              

               

              Although I can't say I really fully understand what is going on here.  I thought I understood that the dependencies in the <deployment> section applied to the EAR class loader, i.e. that they would be in the same class loader as the jar files in my EAR /lib directory.  Furthermore, I thought that if the WAR class loader failed to load a class it would fall back to the EAR class loader.

               

              Clearly the jars in my EAR's /lib directory are being used by the WAR (otherwise my application wouldn't work at all).  Furthermore there are references within those jars (in the EAR's /lib directory) to Hibernate and those are being satisfied by the <deployment> dependencies.  I do not understand how to reconcile this.  Am I wrong somewhere or just missing another piece?