Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-4813

EAR with WAR classloading isolation & commons-httpclient

    XMLWordPrintable

Details

    Description

      We have an EAR including 4 modules :

      • an ejb .jar,
      • persistence .har
      • 2 webapps.

      3 modules – the ejb .jar and the 2 webapps, depends on commons-httpclient 3.1, different from jboss version which 2.x, so I've first maid the EAR isolated by adding the jboss-app.xml with instruction given in JBoss wiki about EAR classloading.

      == META-INF/jboss-app.xml ==
      <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN"
      "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd">

      <jboss-app>
      <loader-repository>my.package:loader=My.ear
      <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
      </loader-repository>
      <jmx-name>my.package:module=My.ear</jmx-name>
      <module>
      <har>MyPersistence.har</har>
      </module>
      </jboss-app>

      Then I've added Class-Path attribute in ejb .jar manifest.

      == ejb.jar | META-INF/MANIFEST.MF ==

      Manifest-Version: 1.0
      Class-Path: lib/commons-httpclient-3.1.jar lib/commons-codec-1.2.jar l
      ib/lucene-core-2.0.0.jar lib/commons-lang-2.3.jar lib/j2cdk.jar lib/l
      ucene-analyzers-2.0.0.jar

      (Line breaks there are as in MANIFEST.MF when I extract it from the jar.)

      I've also manifest files in WAR for the 2 webapps, but I'm not sure jboss/jbossweb(tomcat) take care of it.

      == webapp1.war | META-INF/MANIFEST.MF ==

      Manifest-Version: 1.0
      Class-Path: lib/a-web-lib.jar lib/commons-beanutils-1.7.0.jar li
      b/commons-beanutils-core-1.7.0.jar lib/commons-digester-1.6.jar lib/c
      ommons-fileupload-1.0.jar lib/j2cdk-taglib.jar lib/j2cdk.jar lib/jgen
      .jar lib/jstl.jar lib/standard.jar lib/struts-1.2.9.jar lib/taglibs-m
      ailer.jar lib/commons-httpclient-3.1.jar

      == webapp2.war | META-INF/MANIFEST.MF ==

      Manifest-Version: 1.0
      Class-Path: lib/a-web-lib.jar lib/commons-beanutils-1.7.0.jar li
      b/commons-beanutils-core-1.7.0.jar lib/commons-digester-1.6.jar lib/j
      2cdk-taglib.jar lib/j2cdk.jar lib/jgen.jar lib/jstl.jar lib/standard.
      jar lib/struts-1.2.9.jar lib/taglibs-mailer.jar lib/htmlparser-1.0-SN
      APSHOT.jar lib/commons-httpclient-3.1.jar

      And I've also jboss-web.xml files in these two WAR, even if there are included when deployed inside EAR (which is the top deployment in this case), with the same load repository specified "my.package:loader=My.ear".

      == webapp1.war | WEB-INF/MANIFEST.MF ==

      <?xml version='1.0' encoding='UTF-8'?>
      <!DOCTYPE jboss-web
      PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN"
      "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">

      <jboss-web>
      <context-root>/BO</context-root>
      <virtual-host>www.my-vhost.com</virtual-host>

      <class-loading java2ClassLoadingCompliance="false">
      <loader-repository>my.package:loader=My.ear
      <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
      </loader-repository>
      </class-loading>
      </jboss-web>

      == webapp2.war | WEB-INF/MANIFEST.MF ==

      <?xml version='1.0' encoding='UTF-8'?>
      <!DOCTYPE jboss-web
      PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN"
      "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">

      <jboss-web>
      <context-root>/</context-root>
      <virtual-host>www.my-vhost.com</virtual-host>

      <class-loading java2ClassLoadingCompliance="false">
      <loader-repository>my.package:loader=My.ear
      <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
      </loader-repository>
      </class-loading>
      </jboss-web>

      Ok, that the situation. All work well on several developpement servers (tested on 3 linux hosts and 1 os x), it can be deployed without any error on prodution server (which environement is indicated in this issue), but I get an exception when I test it.

      The exceptions occurs when I call a JSP, not precompiled and so compiled on-the-fly by jbossweb (as on developpement servers where it works fine). Then I get a NoSuchMethodException about getParams() on org.apache.commons.httpclient.HttpConnectionManager. In fact this method doesn't exist in commons-httpclient 2.x included in JBoss, that why I include it as lib in EAR, and isolate this one.

      If I replace the commons-httpclient in jboss/server/default/lib by mine it works fine.

      I've tested on 3 other server with the same JBoss, same JVM and same EAR, it works on the others. I'm sure JBoss/JVM/EAR are absolutely the same as on the production server because in fact I've make a tar file of all this on the server before transfering it on the 3 others.

      2 of these test server have the same linux version (kernel), excepted SMP support.

      Here is where I'm. In fact now I really don't know what could cause this difference, and prevent EAR from working on production jboss server. Could it be related to the SMP (2 cpu) ? Does in this case jbossweb compile with a different classloader for the second cpu ? Maybe silly but I haven't real idea.

      So please if you can give some useful information.

      Attachments

        Activity

          People

            rmaucher Remy Maucherat
            cchantep Cédric Chantepie (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: