Hi, There,

I hope someone can help me with the problem I have with undeploying a webapp. 
We recently upgrade from 5.5 to 7 and whenever I  undeploy our web app, I will 
get an exception like this:
Feb 1, 2011 4:27:13 PM org.apache.catalina.util.LifecycleMBeanBase unregister
WARNING: Failed to unregister MBean with name 
[Catalina:j2eeType=WebModule,name=//localhost/report,J2EEApplication=none,J2EEServer=none]
 during component destruction
javax.management.InstanceNotFoundException: 
Catalina:j2eeType=WebModule,name=//localhost/report,J2EEApplication=none,J2EEServer=none


I debug into tomcat code. And what I found out is that the context Mbean is 
first unregistered by ServerLifeCycleListener when it handles  "remove child" 
event.
JmxMBeanServer.unregisterMBean(ObjectName) line: 506
MBeanUtils.destroyMBean(NamingResources) line: 1358
ServerLifecycleListener.destroyMBeans(NamingResources) line: 832
ServerLifecycleListener.destroyMBeans(Context) line: 655
ServerLifecycleListener.processContainerRemoveChild(Container, Container) line: 
1044
ServerLifecycleListener.containerEvent(ContainerEvent) line: 107
StandardHost(ContainerBase).fireContainerEvent(String, Object) line: 1261
StandardHost(ContainerBase).removeChild(Container) line: 960
HostConfig.checkResources(HostConfig$DeployedApplication) line: 1178
HostConfig.check(String) line: 1347

But the standardContext will unregister the same bean again when it's destroy 
method get called after that ServerLifeCycleListener   handles "remove child". 
That is why the exception:

JmxMBeanServer.unregisterMBean(ObjectName) line: 506
StandardContext(LifecycleMBeanBase).unregister(ObjectName) line: 191
StandardContext(LifecycleMBeanBase).destroyInternal() line: 73
StandardContext(ContainerBase).destroyInternal() line: 1116
StandardContext.destroyInternal() line: 5351
StandardContext(LifecycleBase).destroy() line: 285
StandardHost(ContainerBase).removeChild(Container) line: 969
HostConfig.checkResources(HostConfig$DeployedApplication) line: 1178
HostConfig.check(String) line: 1347

These two happened in one call to  HostConfig.check.  I didn't see anyone else 
report the problem, so I think I might not configure the server correctly or  
my program  might be not coded right to undeploy an web app. But I did study 
the Managerservlet comes with tomcat which handle deployment and undeployment. 
I didn't see any significant difference. I also copy the code. I still get the 
same error.  I notice in tomcat 5.5 source code. The code for unregister 
context mbean in ServerLifeCycleListener  is commented out. That is why we 
don't have the problem in 5.5.  Hope someone can tell me what I did wrong.

Thanks,

Ming




Reply via email to