Bug 50826 - (Embedded) Tomcat.destroy() throws java.lang.IllegalArgumentException
(Embedded) Tomcat.destroy() throws java.lang.IllegalArgumentException
Status: RESOLVED FIXED
Product: Tomcat 7
Classification: Unclassified
Component: Catalina
7.0.8
PC Linux
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2011-02-24 08:47 UTC by Maxim Valyanskiy
Modified: 2011-02-24 12:26 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxim Valyanskiy 2011-02-24 08:47:47 UTC
Embedded Tomcat sometimes throws this exception when calling destroy() method:

java.lang.IllegalArgumentException: null source
	at java.util.EventObject.<init>(EventObject.java:56)
	at javax.management.Notification.<init>(Notification.java:184)
	at org.apache.catalina.core.StandardContext.destroyInternal(StandardContext.java:5433)
	at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:285)
	at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:969)
	at org.apache.catalina.core.ContainerBase.destroyInternal(ContainerBase.java:1108)
	at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:285)
	at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:969)
	at org.apache.catalina.core.ContainerBase.destroyInternal(ContainerBase.java:1108)
	at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:285)
	at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:593)
	at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:285)
	at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:786)
	at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:285)
	at org.apache.catalina.startup.Tomcat.destroy(Tomcat.java:323)
	at su.msk.jet.nioproxy.rule.config.EmbeddedWebserver.stop(EmbeddedWebserver.java:26)

I think that StandardContext.destroyInternal() misses check that this.getObjectName()!=null
Comment 1 Mark Thomas 2011-02-24 12:26:54 UTC
Thanks for the report. This has been fixed in 7.0.x and will be included in 7.0.9 onwards.

To avoid it in the meantime, ensure that the embedded Tomcat instance is started before you destroy it.