[ https://issues.apache.org/jira/browse/AMQ-585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15258194#comment-15258194 ]
Petr Stuchlik commented on AMQ-585: ----------------------------------- Hello there. Sorry to bring this up again, but I am probably experiencing the same issue here 6 years later. System setup: - Linux Mint 17.3 x64 - Tomcat 7 with activemq-all.jar (v5.10.0) in tomcat7/lib {code:title=Tomcat context.xml} <Resource name="jms/myConnectionFactory" auth="Container" type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS Connection Factory" factory="org.apache.activemq.jndi.JNDIReferenceFactory" brokerURL="vm://localhost" brokerName="LocalActiveMQBroker" userName="activemq" password="activemq" useEmbeddedBroker="false" /> {code} Using JMS with Spring 4.2.5 (Spring Integration JMS & Java DSL config). When invoking JMS outbound adapter I get the above-mentioned {{InstanceAlreadyExistsException}}. If I add {{useJmx="false"}}, the exception disappears. To answer the questions for [~jstrachan]: - Spring context is closed. I tried clean deploy and tomcat restart as well. - I don't see any logging related to AMQ other than a clash of bindings (not related I suppose): {code} SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/usr/share/tomcat7/lib/activemq-all.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/var/lib/tomcat7/webapps/ROOT/WEB-INF/lib/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder] {code} - I load multiple xml classpath files including spring-context.xml in my web.xml. I also import some JavaConfig beans and use aop proxy. Any ideas? > InstanceAlreadyExistsException on .war redeploy (if useJmx="true) > ----------------------------------------------------------------- > > Key: AMQ-585 > URL: https://issues.apache.org/jira/browse/AMQ-585 > Project: ActiveMQ > Issue Type: Bug > Components: Broker > Affects Versions: 4.0 M4 > Environment: SuSe Linux 9.1, Sun JDK 1.4.2_08, Tomcat 5.0.28 > Reporter: Mass Dosage > Priority: Minor > Fix For: 4.0 RC2 > > > 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. -- This message was sent by Atlassian JIRA (v6.3.4#6332)