Results 1 to 8 of 8

Thread: InstanceAlreadyExistsException in Websphere

Hybrid View

  1. #1
    Join Date
    Oct 2004
    Location
    Austin, TX, USA
    Posts
    60

    Default 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
    Last edited by robmoore; Feb 23rd, 2007 at 12:59 PM.

  2. #2

    Default

    Hi Rob,

    I assume you are running on Windows rather than zOS? I think you may have a threading issue here?

    IBM currently recommends that applications should avoid using the Spring JMX ConnectorServerFactoryBean as it starts unmanaged threads.

    You could try the provided WebSphere JMX server to see if the problem goes away.
    Sara Mitchell
    WebSphere Development
    MP 127 IBM Hursley Park Winchester SO21 2JN

  3. #3
    Join Date
    Oct 2004
    Location
    Austin, TX, USA
    Posts
    60

    Default

    Hi, Sara,

    Thanks for the reply. I'm actually running on RHEL 4. I'll try removing the factory bean to see if that helps and report back.

    Rob

  4. #4
    Join Date
    Oct 2004
    Location
    Austin, TX, USA
    Posts
    60

    Default

    OK, I tried commenting out the MBeanServerFactoryBean instance but I'm still seeing the same behavior.

    Rob

  5. #5
    Join Date
    Oct 2006
    Posts
    2

    Default 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 View Post
    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

  6. #6
    Join Date
    Feb 2007
    Location
    Milan - Italy
    Posts
    19

    Default Jmx @ Was

    Hi,
    I'm having similar problem on WAS 6.1.0.2. The best solution I think is to use the Websphere 6 default's RMIConnector or SOAPConnector server, in this case it is WAS that controls the connector thread. Actually I have some problem to connect to these connector servers and reading WAS documentation didn't helped me.
    I tried different service urls, only the following seems to work:
    Code:
    <bean id="oe.serverConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean" depends-on="oe.rmiRegistry">
           <property name="serviceUrl" value="service:jmx:rmi:///jndi/rmi://:8880/jmxrmi" />
    </bean>
    <bean id="oe.rmiRegistry" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean">
            <property name="port" value="8880" />
    </bean>
    and in this case I'm creating a connector server using Spring.
    Can I ask you which form of service url are you actually using on WebSphere Application Server 6.1?

  7. #7
    Join Date
    Oct 2006
    Posts
    2

    Default 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...

  8. #8
    Join Date
    Apr 2007
    Posts
    1

    Default

    This issue has also been reported in non-Spring applications running on WebSphere 6.1. JBossCache and ActiveMQ forums report similar problems.

    The ActiveMQ forum posting indicates that this problem occurs because WebSphere modifies the object name when it registers it with the JMX server. Consequently applications which try to detect the existence of a registered name using the name they originally provided will fail since the registration is under a different name.

    See http://issues.apache.org/activemq/browse/SM-883 for further details.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •