Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-585

InstanceAlreadyExistsException on .war redeploy (if useJmx="true)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.0 M4
    • 4.0 RC2
    • Broker
    • None
    • SuSe Linux 9.1, Sun JDK 1.4.2_08, Tomcat 5.0.28

    Description

      I am using ActiveMQ as part of a web-app deployed to Tomcat. Active MQ is configured via spring and follows the spring examples that you ship with the source in M4. If I configure the broker to use JMX ( <broker useJmx="true"> ) and deploy the app to tomcat, everything goes fine. However, when I deploy a newer version of the app (hot deploy) I get the following error when the JMS consumer is created from spring:

      006-02-20 15:16:17,378 ERROR org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:205) Context initialization failed
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'smsResponseConsumer' defined in ServletContext resource [/WEB-INF/applicationContext-messaging.xml]: Initialization of bean failed; nested exception is javax.jms.JMSException: org.apache.activemq:Type=Topic,Destination=ActiveMQ.Advisory.Connection,BrokerName=localhost
      javax.jms.JMSException: org.apache.activemq:Type=Topic,Destination=ActiveMQ.Advisory.Connection,BrokerName=localhost

      And the root cause of this exception is:

      Caused by: javax.management.InstanceAlreadyExistsException: org.apache.activemq:Type=Topic,Destination=ActiveMQ.Advisory.Connection,BrokerName=localhost
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
      at org.apache.activemq.openwire.DataStreamMarshaller.createThrowable(DataStreamMarshaller.java:199)
      at org.apache.activemq.openwire.DataStreamMarshaller.unmarsalThrowable(DataStreamMarshaller.java:159)
      at org.apache.activemq.openwire.v1.ExceptionResponseMarshaller.unmarshal(ExceptionResponseMarshaller.java:67)
      at org.apache.activemq.openwire.OpenWireFormat.doUnmarshal(OpenWireFormat.java:214)
      at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:181)
      at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:135)
      ... 1 more

      So it appears as if the JMX entry isn't "unbound" when the applicaiton restarts on a redeploy.

      If I set JMX to false then I can redeploy the application without any errors.

      Attachments

        Activity

          People

            Unassigned Unassigned
            massdosage Mass Dosage
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: