commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: LogConfigurationException while using STRUTS with two applications in same App Server
Date Mon, 08 Mar 2004 17:35:35 GMT
Quoting vshaiva@optonline.net:

> We are running two STRUTS 1.0 applications using Log4j 1.2.6 in iPlanet 6.5
> Application servers. We have deployed struts  (1.0), commons-beanutils (1.6),
> common-collections (2.1), 
> commons-digester (1.5), commons-logging (1.0.3), commons-validator (1.0.2)
> and  log4j1.2.6 under the WEB-INF/lib and packaged them as separate ear files
> for each application separately. The Action servlet in each application is
> deployed with a different name. Each application has an initializer servlet
> that is invoked at application server startup and loads the Log4J
> configuration.
> 
> The above works fine with only one application and also on occasion with both
> 
> applications. However, we are getting intermittent errors when running both 
> applications together when the requested JSP fails to load with an error in
> the 
> application server kjs logs. We have observed the following pattern of
> errors: 
> (with debugging turned on)
> 
> Always starts with one LogConfigurationException (see Error #1 below). This 
> error does not always happen at startup. It can happen even after some usage
> of 
> the applications. Once this error has occured, we get a 
> java.lang.NoClassDefFoundError  (see Error #2 below) when  the JSP page load
> 
> occurs in the application. 
> 
> Has anyone seen this error ? Any insight would be much appreciated.
> THANKS.

The "FooLogger does not implement Log" exception error is a little bit
misleading in Commons Logger 1.0.3.  The most common cause is that you have two
copies of commons-logging available in the class loader hierarchy visible to
your web application (perhaps one copy inside the webapp and once copy inside
the container).  That kind of configuration is not supported, and leads to this
error *sometimes* based on the order that classes get loaded in.

The root cause to this problem is that a class Foo loaded from one class loader
is *not* the same class as class Foo loaded from a different class loader, even
if the bytecodes are identical.

If you want to try an experiment, could you grab the latest nightly build of
commons-logging (essentially equivalent to what will become 1.0.4 soon) at:

  http://cvs.apache.org/builds/jakarta-commons/nightly/commons-logging/

and try that?  Among other things, we have enhanced the
LogConfigurationException error message if this (two copies of the logging
classes) is indeed the cause of the problem.

If it is, you are going to need to arrange things such that there is only one
copy of commons-logging.jar, and put your log4j.jar in the same place.

Craig



> Error #1
> ------------
> Loading servlet: App1Action
> [06/Mar/2004 13:01:39:3] error: Exception: SERVLET-execution_failed: Error in
> 
> executing servlet EAMSAction: java.lang.ExceptionInInitializerError 
> Exception Stack Trace: 
> java.lang.ExceptionInInitializerError: 
> org.apache.commons.logging.LogConfigurationException: 
> org.apache.commons.logging.LogConfigurationException: 
> org.apache.commons.logging.LogConfigurationException: 
> Class org.apache.commons.logging.impl.Log4JLogger does not implement Log
> 	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance
> (LogFactoryImpl.java:532)
> 	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance
> (LogFactoryImpl.java:272)
> 	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance
> (LogFactoryImpl.java:246)
> 	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
> 	at org.apache.struts.action.ActionServlet.<clinit>
> (ActionServlet.java:375)
> 	at java.lang.Class.newInstance0(Native Method)
> 	at java.lang.Class.newInstance(Class.java:232)
> 	at 
>
com.netscape.server.servlet.servletrunner.ServletRepository.loadServlet(Unknown
> 
> Source)
> 	at 
> com.netscape.server.servlet.servletrunner.ServletRepository.createInstance
> (Unknown Source)
> 	at 
> com.netscape.server.servlet.servletrunner.ServletRunner.createServletInfo
> (ServletRunner.java:1237)
> 	at com.netscape.server.servlet.servletrunner.AppInfo.preLoadServlets
> (Unknown Source)
> 	at com.netscape.server.servlet.servletrunner.AppInfo.resetServlets
> (Unknown Source)
> 	at com.netscape.server.servlet.servletrunner.AppInfo.<init>(Unknown 
> Source)
> 	at com.netscape.server.servlet.servletrunner.ServletModule.getAppInfo
> (Unknown Source)
> 	at com.netscape.server.servlet.servletrunner.ServletRunner.getAppInfo
> (ServletRunner.java:1546)
> 	at com.netscape.server.servlet.servletrunner.ServletRunner.execute
> (ServletRunner.java:986)
> 	at com.kivasoft.applogic.AppLogic.execute(AppLogic.java:152)
> 	at com.kivasoft.applogic.AppLogic.execute(AppLogic.java:86)
> 	at com.kivasoft.thread.ThreadBasic.run(Native Method)
> 	at java.lang.Thread.run(Thread.java:479)
> 
> MessageHeaders:setHeaderField(): Invoking headers.put(name, value)
> 
> [06/Mar/2004 13:01:39:3] error: APPLOGIC-caught_exception: Caught Exception:
> 
> java.lang.ClassCastException: java.lang.ExceptionInInitializerError
> 	at com.netscape.server.servlet.servletrunner.ServletRunner.reportError
> (ServletRunner.java:1576)
> 	at com.netscape.server.servlet.servletrunner.ServletRunner.execute
> (ServletRunner.java:1002)
> 	at com.kivasoft.applogic.AppLogic.execute(AppLogic.java:152)
> 	at com.kivasoft.applogic.AppLogic.execute(AppLogic.java:86)
> 	at com.kivasoft.thread.ThreadBasic.run(Native Method)
> 	at java.lang.Thread.run(Thread.java:479)
> 
> 
> Error #2: This happens when the application is accessing a page.
>
--------------------------------------------------------------------------------
> --------------
> Loading servlet: App1Action
> [06/Mar/2004 13:38:23:7] error: Exception: SERVLET-execution_failed: Error in
> 
> executing servlet App1Action: java.lang.NoClassDefFoundError 
> Exception Stack Trace: 
> java.lang.NoClassDefFoundError
> 	at java.lang.Class.newInstance0(Native Method)
> 	at java.lang.Class.newInstance(Class.java:232)
> 	at 
>
com.netscape.server.servlet.servletrunner.ServletRepository.loadServlet(Unknown
> 
> Source)
> 	at 
> com.netscape.server.servlet.servletrunner.ServletRepository.createInstance
> (Unknown Source)
> 	at 
> com.netscape.server.servlet.servletrunner.ServletRunner.createServletInfo
> (ServletRunner.java:1237)
> 	at com.netscape.server.servlet.servletrunner.AppInfo.preLoadServlets
> (Unknown Source)
> 	at com.netscape.server.servlet.servletrunner.AppInfo.resetServlets
> (Unknown Source)
> 	at com.netscape.server.servlet.servletrunner.AppInfo.<init>(Unknown 
> Source)
> 	at com.netscape.server.servlet.servletrunner.ServletModule.getAppInfo
> (Unknown Source)
> 	at com.netscape.server.servlet.servletrunner.ServletRunner.getAppInfo
> (ServletRunner.java:1546)
> 	at com.netscape.server.servlet.servletrunner.ServletRunner.execute
> (ServletRunner.java:986)
> 	at com.kivasoft.applogic.AppLogic.execute(AppLogic.java:152)
> 	at com.kivasoft.applogic.AppLogic.execute(AppLogic.java:86)
> 	at com.kivasoft.thread.ThreadBasic.run(Native Method)
> 	at java.lang.Thread.run(Thread.java:479)
> 
> MessageHeaders:setHeaderField(): Invoking headers.put(name, value)
> 
> [06/Mar/2004 13:38:23:7] error: APPLOGIC-caught_exception: Caught Exception:
> 
> java.lang.ClassCastException: java.lang.NoClassDefFoundError
> 	at com.netscape.server.servlet.servletrunner.ServletRunner.reportError
> (ServletRunner.java:1576)
> 	at com.netscape.server.servlet.servletrunner.ServletRunner.execute
> (ServletRunner.java:1002)
> 	at com.kivasoft.applogic.AppLogic.execute(AppLogic.java:152)
> 	at com.kivasoft.applogic.AppLogic.execute(AppLogic.java:86)
> 	at com.kivasoft.thread.ThreadBasic.run(Native Method)
> 	at java.lang.Thread.run(Thread.java:479)
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message