tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 41059] - WebAppClassLoader clearReferences code break running threads
Date Fri, 04 May 2007 16:20:58 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41059>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41059





------- Additional Comments From michael.a.moynihan@fmr.com  2007-05-04 09:20 -------
This is causing a problem for me also and I think requires a fix other than the 
patch given here. I get the following stack trace which shows that the error 
occurs on  Tomcat's clean up thread and therefore should be addressed with a 
more permanent fix.

The problem arises because Tomcat tries to null a static/final field of a type 
that has not yet been loaded, which causes the class initializer to run. In my 
case, that initializer fetched a log from Commons Logging, which had 
(presumably) already been "cleaned up" by Tomcat, and threw an NPE.


[FATAL] LoggingInit - Failed to obtain logger returning simple logger for 
CONFIG.com.commons.monitoring.util.Instrument 
<org.apache.commons.logging.LogConfigurationException: 
java.lang.NullPointerException (Caused by java.lang.NullPointerException)
>org.apache.commons.logging.LogConfigurationException: 
java.lang.NullPointerException (Caused by java.lang.NullPointerException)
	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance
(LogFactoryImpl.java:538)
	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance
(LogFactoryImpl.java:235)
	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:370)
	at com.commons.logging.LoggingInit.getLog(LoggingInit.java:334)
	at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.commons.catalog.CatalogUtils.getLog(CatalogUtils.java:75)
	at com.commons.catalog.GenericTrace.<init>(GenericTrace.java:279)
	at com.commons.catalog.SimpleTrace.<init>(SimpleTrace.java:34)
	at com.commons.monitoring.util.Instrument.<clinit>
(AbstractRuntimeInstrument.java:44)
	at sun.misc.Unsafe.ensureClassInitialized(Native Method)
	at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(Unknown 
Source)
	at sun.reflect.ReflectionFactory.newFieldAccessor(Unknown Source)
	at java.lang.reflect.Field.acquireFieldAccessor(Unknown Source)
	at java.lang.reflect.Field.getFieldAccessor(Unknown Source)
	at java.lang.reflect.Field.get(Unknown Source)
	at org.apache.catalina.loader.WebappClassLoader.clearReferences
(WebappClassLoader.java:1612)
	at org.apache.catalina.loader.WebappClassLoader.stop
(WebappClassLoader.java:1496)
	at org.apache.catalina.loader.WebappLoader.stop(WebappLoader.java:734)
	at org.apache.catalina.core.StandardContext.stop
(StandardContext.java:4398)
	at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1067)
	at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1067)
	at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:448)
	at org.apache.catalina.core.StandardService.stop
(StandardService.java:510)
	at org.apache.catalina.core.StandardServer.stop(StandardServer.java:734)
	at org.apache.catalina.startup.Catalina.stop(Catalina.java:602)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:577)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: java.lang.NullPointerException


Upgrading Commons Logging to v1.1 on Tomcat's server classpath removes the NPE 
but the problem isn't really fixed.

Possible solution is to use two phases: first collect all the non-null Fields 
(Field.get will cause the declared type to be loaded) then null them.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message