EAR with WAR classloading isolation & commons-httpclient
--------------------------------------------------------
Key: JBAS-4813
URL:
http://jira.jboss.com/jira/browse/JBAS-4813
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: ClassLoading, Web (Tomcat) service
Affects Versions: JBossAS-4.0.5.GA, JBossAS-4.0.3 SP1
Environment: Linux 2.6.11-1.1369_FC4smp (Fedora Core 4) 2005 i686 i686 i386
GNU/Linux
jrockit-R26.4.0-jdk1.5.0_06
Reporter: C←dric Chantepie
Assigned To: Scott M Stark
Priority: Blocker
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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira