Jothir,
Please file a bug.
The exception indicates that an MBean has already been registered,
which suggests a possible race condition with multiple threads or a
logic error that tries to register twice.
In examining CascadingLifecycleImpl, I note that it is definitely not
thread safe, nor is InstanceCascadingMBean, which calls it. In
particular:
- 'cMap' is not synchronized in any way; it is not a synchronized map
(eg Collections.synchronizedMap).
- cascadeInstance() first removes an entry ('cascadingAgentName'),
then later adds its again. The method is not synchronized, and even
if 'cMap' were synchronized, the method would still need to use a
locking strategy.
Lloyd Chambers
On Dec 20, 2006, at 10:30 PM, jothir ganesan wrote:
> Hi All,
>
> I am in appserver SQE team and I executed a list of tests using AS
> 9.1 EE build 28. Most of my tests restart an instance in a cluster
> (because we test for failover and highavailability features of
> appserver). In the course of execution, when the instance was
> restarted by one test, I noticed "InstanceAlreadyExistsException"
> exception in DAS's server.log. After that, the instance didnot get
> started completely. The stack trace is attached below.
>
>
> [#|2006-12-15T02:59:59.636+0530|WARNING|sun-appserver-ee9.1|
> javax.enterprise.system.stream.err|_ThreadID=1617;_ThreadName=RMI
> TCP Connection
> (5731)-10.12.163.195;_RequestID=3b3998ba-5df5-464b-8a54-c842326f3532;|
> javax.management.InstanceAlreadyExistsException:
> com.sun.appserv:type=CascadingAgent,serverName=instance1
> at com.sun.jmx.mbeanserver.RepositorySupport.addMBean
> (RepositorySupport.java:452)
> at
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObje
> ct(DefaultMBeanServerInterceptor.java:1410)
> at
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject
> (DefaultMBeanServerInterceptor.java:936)
> at
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean
> (DefaultMBeanServerInterceptor.java:337)
> at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean
> (JmxMBeanServer.java:497)
> at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke
> (ProxyClass.java:77)
> at $Proxy1.registerMBean(Unknown Source)
> at
> com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.registerMBe
> an(SunoneInterceptor.java:268)
> at
> com.sun.enterprise.ee.admin.cascading.CascadingLifecycleImpl.cascadeIn
> stance(CascadingLifecycleImpl.java:380)
> at
> com.sun.enterprise.ee.admin.cascading.InstanceCascadingMBean.cascadeIn
> stance(InstanceCascadingMBean.java:302)
> at
> com.sun.enterprise.ee.admin.cascading.InstanceCascadingMBean.invoke
> (InstanceCascadingMBean.java:216)
> at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke
> (DynamicMetaDataImpl.java:213)
> at com.sun.jmx.mbeanserver.MetaDataImpl.invoke
> (MetaDataImpl.java:220)
> at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke
> (DefaultMBeanServerInterceptor.java:815)
> at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke
> (JmxMBeanServer.java:784)
> at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke
> (ProxyClass.java:77)
> at $Proxy1.invoke(Unknown Source)
> at
> com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke
> (SunoneInterceptor.java:297)
> at javax.management.remote.rmi.RMIConnectionImpl.doOperation
> (RMIConnectionImpl.java:1408)
> at javax.management.remote.rmi.RMIConnectionImpl.access$100
> (RMIConnectionImpl.java:81)
> at javax.management.remote.rmi.RMIConnectionImpl
> $PrivilegedOperation.run(RMIConnectionImpl.java:1245)
> at
> javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation
> (RMIConnectionImpl.java:1341)
> at javax.management.remote.rmi.RMIConnectionImpl.invoke
> (RMIConnectionImpl.java:782)
> at sun.reflect.GeneratedMethodAccessor130.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at sun.rmi.server.UnicastServerRef.dispatch
> (UnicastServerRef.java:294)
> at sun.rmi.transport.Transport$1.run(Transport.java:153)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
> at sun.rmi.transport.tcp.TCPTransport.handleMessages
> (TCPTransport.java:466)
> at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run
> (TCPTransport.java:707)
> at java.lang.Thread.run(Thread.java:595)
> |#]
>
> Could anyone please let me know the cause of this issue?
>
> Thanks
> Jothir
>