users@glassfish.java.net

Re: deployment problem on cluster PWC1409

From: <glassfish_at_javadesktop.org>
Date: Wed, 28 Jan 2009 14:24:12 PST

Hi Jon,

it turned out that your domain also contained a commons-logging.jar in its lib directory, which was version incompatible with the commons-logging.jar bundled with your app.

Normally, one would be able to bypass the issue by setting the webapp classloader's "delegate" flag to "false", as shown in this sun-web.xml snippet (which would be bundled with the webapp):

  <sun-web-app>
    <class-loader delegate="false"/>
  </sun-web-app>

With this setting, any references from log4j to symbols in org.apache.commons.logging would first be resolved against the commons-logging.jar that's bundled in the app, before delegating to the parent classloader.

However, that did not work for you either (and also did not work for me as I was reproducing the issue locally).

The reason is that the WebappClassLoader is (wrongly) instructed to unconditionally delegate the resolution of any symbols in the org.apache.commons.logging namespace to its parent, regardless of the setting of its "delegate" flag.

I have verified that the following diffs, which remove org.apache.commons.logging from the list of packages for which delegation is enforced unconditionally, fix the issue (i.e., setting "delegate" to false now has the intended effect with respect to the resolution of any symbols in org.apache.commons.logging, and ultimately makes the deployment of your app successful):

Index: WebappClassLoader.java
===================================================================
RCS file: /cvs/glassfish/appserv-webtier/src/java/org/apache/catalina/loader/WebappClassLoader.java,v
retrieving revision 1.34.6.11
diff -u -r1.34.6.11 WebappClassLoader.java
--- WebappClassLoader.java 20 Nov 2008 18:29:11 -0000 1.34.6.11
+++ WebappClassLoader.java 28 Jan 2009 22:14:16 -0000
@@ -228,7 +228,6 @@
         "org.apache.xalan", // Xalan
         "org.apache.taglibs.standard", // JSTL (Java EE 5)
         "com.sun.faces", // JSF (Java EE 5)
- "org.apache.commons.logging" // Commons logging
     };

I hope to be able to provide the fix in patch release for GlassFish v2.1.

Thanks!

Jan
[Message sent by forum member 'jluehe' (jluehe)]

http://forums.java.net/jive/thread.jspa?messageID=328794