Announcement Announcement Module
Collapse
No announcement yet.
"InstanceAlreadyExistsException" while exposing MBeans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • "InstanceAlreadyExistsException" while exposing MBeans

    Env: Spring 2.0.7, JDK1.6

    I am exposing my MBeans using RMI with the following configuration.
    I keep getting the InstanceAlreadyExistsException. Could you pl tell me
    where I have this wrong?

    Regards

    /U

    My configuration is "MyJmxElements.xml:
    Code:
      <bean
              id="MyBeanServer"
              class="org.springframework.jmx.support.MBeanServerFactoryBean"
    
              p:defaultDomain="UDomain"
            />
    
         <bean id="MyJmxRmiRegistry"
             class="org.springframework.remoting.rmi.RmiRegistryFactoryBean"
                p:port="9999"
         />
    
         <bean
             class="org.springframework.jmx.support.ConnectorServerFactoryBean"
             depends-on="MyJmxRmiRegistry"
                p:serviceUrl="service:jmx:rmi:///jndi/rmi://localhost:9999/server"
                p:objectName="connector:name=MyDomain"
         />
    At context load, I get the exception as follows:

    Code:
    2007-12-16 13:49:09,305 ERROR [main] context.ContextLoader:204     - Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.jmx.support.ConnectorServerFactoryBean#1' defined in class path resource [MyJmxElements.xml]: Invocation of init method failed; nested exception is javax.management.InstanceAlreadyExistsException: connector:name=MyDomain
    Caused by:
    javax.management.InstanceAlreadyExistsException: connector:name=MyDomain
            at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:453)
            at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1484)

  • #2
    I am running in Tomcat 6.0.14.
    Also I have modified the MBeanServerFactoryBean as follows
    to add the property p:locateExistingServerIfPossible="true".
    I still get the same (InstanceAlreadyExistsException) exception:

    Code:
     <bean
              id="MyMBeanServer"
              class="org.springframework.jmx.support.MBeanServerFactoryBean"
              
              p:defaultDomain="UDomain"
              p:locateExistingServerIfPossible="true"
            />
    Pl help!

    /U
    Last edited by umark; Dec 16th, 2007, 06:06 PM. Reason: Fix typo

    Comment


    • #3
      More clarification

      I am sorry for following up again on my post. I have been trying various
      changes to see what would do the trick.

      What is the purpose of the objectName property of org.springframework.jmx.support.ConnectorServerFac toryBean?
      Why should I set them?

      Code:
           <bean 
               class="org.springframework.jmx.support.ConnectorServerFactoryBean"
               depends-on="DmsJmxRmiRegistry"
                  p:serviceUrl="service:jmx:rmi:///jndi/rmi://localhost:9999/server"
                  p:threaded="true"
                  p:objectName="connector:name=rmi"
           />
      If I set the property (as shown above), I get the
      javax.management.InstanceAlreadyExistsException as follows:

      Code:
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.jmx.support.ConnectorServerFactoryBean#1' defined in class path resource [MyJmxElements.xml]: Invocation of init method failed; nested exception is javax.management.InstanceAlreadyExistsException: connector:name=rmi
      Caused by:
      javax.management.InstanceAlreadyExistsException: connector:name=rmi
              at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:453)
              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1484)
              at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:963)
      //...
      But if I discard the property (I assume ConnectorServerFactoryBean assumes
      a default), the exception does not appear.

      Does the objectName property of ConnectorServerFactoryBean have any
      correlation to the object names I use for my MBean server and my MBeans?

      I am at my wits end - pl help!

      Comment

      Working...
      X