InstanceAlreadyExistsException in Websphere
I'm running 6.1.0.5 of Websphere with Spring 1.2.8 and am running into a problem with registering mbeans at start up. The first time I start up Websphere with the app I don't see any errors. However, after stopping and restarting I see errors like the following for each of my mbeans:
Code:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmxExporter' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is javax.management.InstanceAlreadyExistsException: ntc:cell=robtestNode01Cell,name=messageManager,node=robtestNode01,process=server1
javax.management.InstanceAlreadyExistsException: ntc:cell=robtestNode01Cell,name=messageManager,node=robtestNode01,process=server1
I'd assumed that this was because the mbeans weren't being unregistered at shutdown. I've tried several variations of this and at first I wasn't seeing any error messages at shutdown (I believe this was related to setting the server explicitly on the exporter which I've now stopped doing). Now I'm seeing an odd error -- at shutdown mbeans cannot be unregistered because they do not exist:
Code:
2007-02-23 12:49:43,027 WebContainer : 2 ERROR MBeanExporter:780 - Could not unregister MBean [ntc:name=messageManager]
javax.management.InstanceNotFoundException: ntc:name=messageManager
Yet when I restart the application, I inexplicably get the InstanceAlreadyExistsException error.
Just curious if anybody has run into anything like this.
Thanks,
Rob
websphere 6.1 javax.management.InstanceAlreadyExistsException:
I also have the same problem. When I restart my aplication second time, It takes javax.management.InstanceAlreadyExistsException. I have to restart server when I just need to restart application.
Code:
Caused by:
javax.management.InstanceAlreadyExistsException: org.apache.servicemix:Name=ManagementContext,cell=TEK0133Node03Cell,Type=SystemService,ContainerName=JBI1,node=TEK0133Node03,process=server1
at com.sun.jmx.mbeanserver.RepositorySupport.addMBean(RepositorySupport.java:470)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1428)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:954)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:355)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:515)
at com.ibm.ws.management.PlatformMBeanServer.registerMBean(PlatformMBeanServer.java:472)
at org.apache.servicemix.jbi.management.ManagementContext.registerMBean(ManagementContext.java:521)
at org.apache.servicemix.jbi.management.ManagementContext.registerSystemService(ManagementContext.java:594)
I use Servicemix 3.1 in a web application.
I looked at the source code of the framework class (org.apache.servicemix.jbi.management.ManagementCo ntext), and debugged it.
Even isRegistered() method of the com.ibm.ws.management.PlatformMBeanServer returns false it throws exception when registerMBean method is called.
Code:
public void registerMBean(ObjectName name, Object resource, Class interfaceMBean, String description)
throws JMException {
if (mbeanServerContext.getMBeanServer() != null) {
Object mbean = MBeanBuilder.buildStandardMBean(resource, interfaceMBean, description, executors);
if (mbeanServerContext.getMBeanServer().isRegistered(name)) {
mbeanServerContext.getMBeanServer().unregisterMBean(name);
}
mbeanServerContext.getMBeanServer().registerMBean(mbean, name);
beanMap.put(name, resource);
}
}
I tried my application at Windows XP, RAD 7.0(WAS 6.1) and also at AIX - WAS 6.1. I have the same exception in both environment.
On the other hand when I run the same code in Tomcat 5.5 it works fine.
Quote:
Originally Posted by
robmoore
I'm running 6.1.0.5 of Websphere with Spring 1.2.8 and am running into a problem with registering mbeans at start up. The first time I start up Websphere with the app I don't see any errors. However, after stopping and restarting I see errors like the following for each of my mbeans:
Code:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmxExporter' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is javax.management.InstanceAlreadyExistsException: ntc:cell=robtestNode01Cell,name=messageManager,node=robtestNode01,process=server1
javax.management.InstanceAlreadyExistsException: ntc:cell=robtestNode01Cell,name=messageManager,node=robtestNode01,process=server1
I'd assumed that this was because the mbeans weren't being unregistered at shutdown. I've tried several variations of this and at first I wasn't seeing any error messages at shutdown (I believe this was related to setting the server explicitly on the exporter which I've now stopped doing). Now I'm seeing an odd error -- at shutdown mbeans cannot be unregistered because they do not exist:
Code:
2007-02-23 12:49:43,027 WebContainer : 2 ERROR MBeanExporter:780 - Could not unregister MBean [ntc:name=messageManager]
javax.management.InstanceNotFoundException: ntc:name=messageManager
Yet when I restart the application, I inexplicably get the InstanceAlreadyExistsException error.
Just curious if anybody has run into anything like this.
Thanks,
Rob
InstanceAlreadyExistsException in Websphere
My service URL is same as yours.
just rmiRegistry and jmxConnector classes are from servicemix framework but they are basically same with spring ones.
sm:rmiRegistry ---> org.apache.servicemix.jbi.jmx.RmiRegistryFactoryBe an
sm:jmxConnector ---> org.apache.servicemix.jbi.jmx.ConnectorServerFacto ryBean
Code:
<!-- RMI registry -->
<!-- <sm:rmiRegistry id="rmiRegistry" port="1089" locallyCreated="true"/>-->
<!-- JMX server -->
<sm:jmxServer id="jmxServer" locateExistingServerIfPossible="true" />
<!-- JMX Remote connector -->
<sm:jmxConnector objectName="connector:name=rmi"
serviceUrl="service:jmx:rmi:///jndi/rmi://localhost:1089/jmxrmi"
threaded="true"
daemon="true"
depends-on="rmiRegistry"
registrationBehavior="2"/>
As far as I understood you didn't find a solution for InstanceAlreadyExistsException, either. Please let me know if you found anything about that...