4 Replies Latest reply on Feb 18, 2007 2:02 PM by jaikiran

    EAR classloading

    attodorov

      Hi All,

      Our company is evaluating JBoss as an application server choice for
      our current applications to be deployed on. I have two questions
      regarding the structure of the EAR in JBOSS with respect to class
      loading.

      According to the J2EE 1.4 specification, one can put utility jars in
      the EAR, which are visible to all wars and EJB modules that make up
      the enterprise application. I am trying to do that with JBoss, but get
      ClassNotFoundExceptions. If i put all jars in the WAR that needs them,
      all classes are loaded properly.

      My second question is regarding class loader isolation in the EAR
      scope. Suppose I have some enterpise application and several webapps
      in it. At some point they both require the same libraries (jars), but
      one of the webapps wants to use a specific version of some jar only
      for itself. If I have some X.jar as a utility jar visible to two WARs,
      and WAR 1 has another version of X.jar in its own lib directory, which
      classes will be loaded first when the respective class in the webapp 1
      requests them - the ones in its own lib directory, or the shared ones?

      My JBOSS version is:

      Version: 4.0.5GA(build: CVSTag=Branch_4_0 date=200610162340)
      Version Name: Zion
      Built on: October 16 2006

      Thank you very much for the feedback.

      Best Regards,
      Angel

        • 2. Re: EAR classloading
          attodorov

          Hi Jaikiran,

          My webapps use a shared utility jar : commons-httpclient-3.0.1.jar. But this is not loaded first. Instead the commons-httpclient.jar is loaded which resides in the JBoss shared lib dirs. As a result i get method signature incompatibilities - i.e. different interfaces, etc. This contradicts with the options:

          false

          and

          false

          As you can see, both of them are turned off on my configuration. This is actually the default setting for JBoss 4.0.5.

          Is this a bug? Thanks.

          Best Regards,
          Angel

          • 3. Re: EAR classloading
            attodorov

            Hi Jaikiran,

            My webapps use a shared utility jar : commons-httpclient-3.0.1.jar. But this is not loaded first. Instead the commons-httpclient.jar is loaded which resides in the JBoss shared lib dirs. As a result i get method signature incompatibilities - i.e. different interfaces, etc. This contradicts with the options:

            false

            and

            false

            As you can see, both of them are turned off on my configuration. This is actually the default setting for JBoss 4.0.5.

            Is this a bug? Thanks.

            Best Regards,
            Angel

            • 4. Re: EAR classloading
              jaikiran

              Have you configured classloader isolation for your application by specifying

              <jboss-app>
               <loader-repository>
               com.example:loader=unique-archive-name
               <loader-repository-config>
               java2ParentDelegation=false
               </loader-repository-config>
               </loader-repository>
              </jboss-app>


              in the jboss-app.xml file of your ear.