BTM
  1. BTM
  2. BTM-104

JMX registration of Recoverer fails when multiple serverIds are used

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.1.1
    • Labels:
      None
    • Environment:
      Tomcat 6.0.26, Ubuntu Linux 10.04, Spring 3.0.1.RELEASE
    • Number of attachments :
      0

      Description

      When running two separate web application that use Spring configured BTM instances on the same Tomcat instance, the following exception is thrown at startup:

      Caused by: javax.management.InstanceAlreadyExistsException: bitronix.tm:type=Recoverer
      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)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:917)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:482)
      ... 111 more

      This is thrown by ManagementRegistrar.register("bitronix.tm:type=Recoverer", this); in the constructor of Recoverer
      when the second web application starts.

      I'm using the following Spring configuration in each web application with different server ids:

      <bean id="btmConfig" factory-method="getConfiguration" class="bitronix.tm.TransactionManagerServices">

      <property name="serverId" value="$

      {tx.serverId}" />
      <property name="currentNodeOnlyRecovery" value="true" />
      <property name="logPart1Filename" value="${tx.serverId}

      -btm1.tlog" />
      <property name="logPart2Filename" value="$

      {tx.serverId}

      -btm2.tlog" />
      <!-- <property name="disableJmx" value="true"/> -->

      </bean>

      <bean id="jtaTransactionManager" factory-method="getTransactionManager"
      class="bitronix.tm.TransactionManagerServices" depends-on="btmConfig" destroy-method="shutdown" />

      If I set disableJmx to true then there are no exceptions (as expected). Just wonder if there is a way to configure the JMX registration to allow two instances of BTM to use the same JMX server.

        Activity

        Hide
        Ludovic Orban added a comment -

        I never thought of that use case, but it's easy to overcome by prepending the serverId to all JMX names.

        When a JMX object cannot be registered, the error is logged and then is ignored. BTM is still fully functional, minus the monitoring of course.

        Show
        Ludovic Orban added a comment - I never thought of that use case, but it's easy to overcome by prepending the serverId to all JMX names. When a JMX object cannot be registered, the error is logged and then is ignored. BTM is still fully functional, minus the monitoring of course.
        Hide
        Ludovic Orban added a comment -

        Fixed by appending the server ID to the Recoverer's JMX name.

        Show
        Ludovic Orban added a comment - Fixed by appending the server ID to the Recoverer's JMX name.

          People

          • Assignee:
            Ludovic Orban
            Reporter:
            Adam Galloway
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: