users@glassfish.java.net

Glassfish v2 ur2 Xwiki 1.3.2 log4j commons-logging configuration problem

From: <glassfish_at_javadesktop.org>
Date: Mon, 05 May 2008 10:58:06 PDT

Wow, that subject line is a mouthful. Basically, I have a Glassfish V2 ur2 server running (non-clustered) on a Centos 5 server under Sun JDK 1.6.0_01. I have some simple applications running on it and I have successfully launched a recent version of the Hudson build server as well.

I'm trying to deploy and run the Xwiki enterprise war version 1.3.2 on it and I run into a severe deploy error that breaks down to a problem between Apache Commons-Logging and Log4J and the classloaders. This seems to be a common error for these two packages where commons-logging ends up picking up an old version of log4j (from somewhere) that doesn't have the class required to fulfill the requirements of the logging configuration and therefore throws a NoClassDefFoundError (org/apache/log4j/Category).

Can anyone give me a hint as to how I might solve this? If this was WebSphere (which I'm glad it's not) I'd be looking at whether to set the classloader preference to parent-first or parent-last, but I don't see that option for GF v2. Stack trace included below:

[#|2008-05-05T13:23:52.291-0400|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=10;_ThreadName
=main;_RequestID=b5cf0270-9aa2-4da8-affc-1ca22882f0e5;|WebModule[/xwiki]PWC1396: Servlet /xwiki threw load() exception
java.lang.ExceptionInInitializerError
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1132)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1007)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4800)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:5188)
        at com.sun.enterprise.web.WebModule.start(WebModule.java:327)
        at com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
        at com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:296)
        at com.sun.appserv.management.util.misc.RunnableBase._submit(RunnableBase.java:168)
        at com.sun.appserv.management.util.misc.RunnableBase.submit(RunnableBase.java:184)
        at com.sun.enterprise.web.VirtualServer.startChildren(VirtualServer.java:1672)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1231)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:955)
        at com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
        at com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:296)
        at com.sun.appserv.management.util.misc.RunnableBase._submit(RunnableBase.java:168)
        at com.sun.appserv.management.util.misc.RunnableBase.submit(RunnableBase.java:184)
        at com.sun.enterprise.web.EmbeddedWebContainer$WebEngine.startChildren(EmbeddedWebContainer.java:453)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1231)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:533)
        at org.apache.catalina.startup.Embedded.start(Embedded.java:936)
        at com.sun.enterprise.web.WebContainer.start(WebContainer.java:873)
        at com.sun.enterprise.web.PEWebContainer.startInstance(PEWebContainer.java:790)
        at com.sun.enterprise.web.PEWebContainerLifecycle.onStartup(PEWebContainerLifecycle.java:84)
        at com.sun.enterprise.server.ApplicationServer.onStartup(ApplicationServer.java:442)
        at com.sun.enterprise.server.ondemand.OnDemandServer.onStartup(OnDemandServer.java:120)
        at com.sun.enterprise.server.PEMain.run(PEMain.java:411)
        at com.sun.enterprise.server.PEMain.main(PEMain.java:338)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.enterprise.server.PELaunch.main(PELaunch.java:412)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException:
 No suitable Log constructor [Ljava.lang.Class;@df8508 for org.apache.commons.logging.impl.Log4JLogger (Caused by java
.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by org.apache.commons.logging.LogConfigurationException
: No suitable Log constructor [Ljava.lang.Class;@df8508 for org.apache.commons.logging.impl.Log4JLogger (Caused by jav
a.lang.NoClassDefFoundError: org/apache/log4j/Category))
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
        at org.apache.struts.action.ActionServlet.<clinit>(ActionServlet.java:226)
        ... 38 more
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@df8508
 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category)
        at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
        ... 42 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
        at java.lang.Class.getConstructor0(Class.java:2699)
        at java.lang.Class.getConstructor(Class.java:1657)
        at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
        ... 43 more
|#]
[Message sent by forum member 'kslater' (kslater)]

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