Bug 44908

Summary: LoggerConfigurationException Caused by session-timeout Setting in web.xml
Product: Tomcat 4 Reporter: Edwin Lee <edwin11_79>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED INVALID    
Severity: major    
Priority: P2    
Version: 4.1.37   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: WAR file to replicate issue.

Description Edwin Lee 2008-04-30 03:01:11 UTC
JDK version 1.4.2_16

A LoggerConfigurationException would occur if the default web.xml (in the conf directory) or the web.xml in the web-app (in WEB-INF) contains the session-timeout entry

i.e.
<session-config>
    <session-timeout>30</session-timeout>
</session-config>

AND

the WEB-INF/classes directory contains a commons-logging.properties file with the entry org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger.

The console would display

30-Apr-2008 17:44:17 org.apache.commons.digester.Digester endElement
SEVERE: End event threw exception
org.apache.commons.logging.LogConfigurationException: User-specified log class '
org.apache.commons.logging.impl.Log4JLogger' cannot be found or is not useable.
        at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:874)
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:604)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:336)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:310)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685)
        at org.apache.commons.beanutils.ConvertUtilsBean.<init>(ConvertUtilsBean.java:130)
        at org.apache.commons.beanutils.BeanUtilsBean.<init>(BeanUtilsBean.java:110)
        at org.apache.commons.beanutils.BeanUtilsBean$1.initialValue(BeanUtilsBean.java:68)
        at org.apache.commons.beanutils.ContextClassLoaderLocal.get(ContextClassLoaderLocal.java:80)
        at org.apache.commons.beanutils.BeanUtilsBean.getInstance(BeanUtilsBean.java:78)
        at org.apache.commons.beanutils.ConvertUtilsBean.getInstance(ConvertUtilsBean.java:115)
        at org.apache.commons.beanutils.ConvertUtils.convert(ConvertUtils.java:217)
        at org.apache.commons.digester.CallMethodRule.end(CallMethodRule.java:561)
        at org.apache.commons.digester.Rule.end(Rule.java:253)
        at org.apache.commons.digester.Digester.endElement(Digester.java:1222)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
        at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(UnknownSource)
        at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
        at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.apache.commons.digester.Digester.parse(Digester.java:1745)
        at org.apache.catalina.startup.ContextConfig.defaultConfig(ContextConfig.java:488)
        at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:579)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:182)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3644)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:777)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:760)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:538)
        at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:265)
        at org.apache.catalina.core.StandardHost.install(StandardHost.java:731)
        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:649)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:379)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:808)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:335)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1156)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:697)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1148)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:311)
        at org.apache.catalina.core.StandardService.start(StandardService.java:450)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:2213)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:484)
        at org.apache.catalina.startup.Catalina.execute(Catalina.java:371)
        at org.apache.catalina.startup.Catalina.process(Catalina.java:134)
        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:324)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:151)

while the log file in the logs directory would contain

2008-04-30 17:44:17 ContextConfig[/test] Parse error in default web.xml
org.apache.commons.logging.LogConfigurationException: User-specified log class 'org.apache.commons.logging.impl.Log4JLogger' cannot be found or is not useable.
	at org.apache.commons.digester.Digester.createSAXException(Digester.java:3181)
	at org.apache.commons.digester.Digester.createSAXException(Digester.java:3207)
	at org.apache.commons.digester.Digester.endElement(Digester.java:1225)
	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
	at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
	at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
	at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at org.apache.commons.digester.Digester.parse(Digester.java:1745)
	at org.apache.catalina.startup.ContextConfig.defaultConfig(ContextConfig.java:488)
	at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:579)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:182)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:3644)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:777)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:760)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:538)
	at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:265)
	at org.apache.catalina.core.StandardHost.install(StandardHost.java:731)
	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:649)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:379)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:808)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:335)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1156)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:697)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1148)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:311)
	at org.apache.catalina.core.StandardService.start(StandardService.java:450)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:2213)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:484)
	at org.apache.catalina.startup.Catalina.execute(Catalina.java:371)
	at org.apache.catalina.startup.Catalina.process(Catalina.java:134)
	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:324)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:151)

2008-04-30 17:44:17 ContextConfig[/test]: Occurred at line 324 column 46
2008-04-30 17:44:17 ContextConfig[/test] Parse error in application web.xml
org.apache.commons.logging.LogConfigurationException: User-specified log class 'org.apache.commons.logging.impl.Log4JLogger' cannot be found or is not useable.
	at org.apache.commons.digester.Digester.createSAXException(Digester.java:3181)
	at org.apache.commons.digester.Digester.createSAXException(Digester.java:3207)
	at org.apache.commons.digester.Digester.endElement(Digester.java:1225)
	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
	at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
	at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
	at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at org.apache.commons.digester.Digester.parse(Digester.java:1745)
	at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:221)
	at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:580)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:182)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:3644)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:777)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:760)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:538)
	at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:265)
	at org.apache.catalina.core.StandardHost.install(StandardHost.java:731)
	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:649)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:379)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:808)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:335)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1156)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:697)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1148)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:311)
	at org.apache.catalina.core.StandardService.start(StandardService.java:450)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:2213)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:484)
	at org.apache.catalina.startup.Catalina.execute(Catalina.java:371)
	at org.apache.catalina.startup.Catalina.process(Catalina.java:134)
	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:324)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:151)

2008-04-30 17:44:17 ContextConfig[/test]: Occurred at line 6 column 40

Note that both line 324 of the default web.xml and line 6 of the web app web.xml point to the session-timeout entry.

Attached is the WAR file that can be used to replicate this. It contains only
/test (root directory of the web-app)
/test/WEB-INF
/test/WEB-INF/classes
/test/WEB-INF/classes/commons-logging.properties
/test/WEB-INF/web.xml
Comment 1 Edwin Lee 2008-04-30 03:02:22 UTC
Created attachment 21885 [details]
WAR file to replicate issue.
Comment 2 Mark Thomas 2008-05-01 15:42:19 UTC
There might be a bug here but...

log4j isn't provided as part of the standard TC4 distro so the LoggerConfigurationException is understandable.

The reason you are seeing this is that Tomcat tries to log web-app related messages to the logger(s) associated with the web-app. What you are seeing is a side-effect of this.

There have been bugs in this area in the past, usually memory leaks related to class loaders not being properly released, and it wouldn't surprise me if a few more issues of that type were still in TC4.  That said, I don't think this falls into that category.

There are also many, many pages on the web documenting some horrible experiences people have have with logging frameworks and the class loader structure of a typical Servlet container. This has been improved in later versions but the changes are way to invasive to port back to the TC4 branch.

In short, small bugs in the logging will get fixed whereas issues that need architectural changes will not.

All that said, so far this issue looks like a configuration error to me.