This problem stops to appear if I change the variable nextConnectionId from 
long to static long, since it now generate different names for each Connection 
it tries to register with the MBeanServer.

Fan

> ______________________________________________ 
> From:         Li, Fan  
> Sent: Wednesday, April 05, 2006 7:57 PM
> To:   '[email protected]'
> Subject:      InstanceAlreadyExistsException when creating Connections 
> without start them
> 
> Hi:
> 
> I am doing a test where I am creating a number of TopicConnections on 
> different TCP port on my machine, in particular I am using the 
> TransportConnector URIs: "tcp://localhost:61616", "tcp://localhost:61626", 
> "tcp://localhost:61636" and "tcp://localhost:61646". I have started a 
> BrokerService with these four TransportConnectors and I have created four TCP 
> TopicConnections without starting any of them, as a result I am getting 
> InstanceAlreadyExistsException from the registerMBean() method of 
> ManagedTransportConnection class, with the stack trace similar to:
> 
> 2006-04-05 18:35:53,474 [127.0.0.1:61616] WARN  ActiveMQConnection            
>  - Async exception with no exception listener: java.net.SocketException: 
> Connection reset
> java.net.SocketException: Connection reset
>       at java.net.SocketInputStream.read(SocketInputStream.java:168)
>       at 
> org.apache.activemq.transport.tcp.TcpBufferedInputStream.fill(TcpBufferedInputStream.java:48)
>       at 
> org.apache.activemq.transport.tcp.TcpBufferedInputStream.read(TcpBufferedInputStream.java:55)
>       at java.io.DataInputStream.readInt(DataInputStream.java:353)
>       at 
> org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:270)
>       at 
> org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:135)
>       at java.lang.Thread.run(Thread.java:595)
> 2006-04-05 18:35:53,477 [mazon.com:61616] ERROR TransportConnector            
>  - Could not accept connection: java.io.IOException: 
> org.apache.activemq:BrokerName=localhost,Type=Connection,Connection=1
> java.io.IOException: 
> org.apache.activemq:BrokerName=localhost,Type=Connection,Connection=1
>       at 
> org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:36)
>       at 
> org.apache.activemq.broker.jmx.ManagedTransportConnection.registerMBean(ManagedTransportConnection.java:98)
>       at 
> org.apache.activemq.broker.jmx.ManagedTransportConnection.setConnectionId(ManagedTransportConnection.java:78)
>       at 
> org.apache.activemq.broker.jmx.ManagedTransportConnection.<init>(ManagedTransportConnection.java:57)
>       at 
> org.apache.activemq.broker.jmx.ManagedTransportConnector.createConnection(ManagedTransportConnector.java:60)
>       at 
> org.apache.activemq.broker.TransportConnector$1.onAccept(TransportConnector.java:135)
>       at 
> org.apache.activemq.transport.tcp.TcpTransportServer.run(TcpTransportServer.java:137)
>       at java.lang.Thread.run(Thread.java:595)
> Caused by: javax.management.InstanceAlreadyExistsException: 
> org.apache.activemq:BrokerName=localhost,Type=Connection,Connection=1
>       at 
> com.sun.jmx.mbeanserver.RepositorySupport.addMBean(RepositorySupport.java:452)
>       at 
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1410)
>       at 
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:936)
>       at 
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:337)
>       at 
> com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:497)
>       at 
> org.apache.activemq.broker.jmx.ManagedTransportConnection.registerMBean(ManagedTransportConnection.java:95)
>       ... 6 more
> 
> Is it required in ActiveMQ to start a Connection right after its creation? It 
> seems all instances of ManagedTransportConnector for a particular 
> BrokerService share the same MBeanServer. When I run debugger on the 
> registerMBean() method that throws the exception, the objects it tries to 
> register with the MBeanServer appears to be different, but the name it tries 
> to register them under seems to be the same 
> "org.apache.activemq:BrokerName=localhost,Connection=1,Type=Connection". Do 
> anyone know what might be the cause of this?
> 
> Thanks
> Fan
> 
> 

Reply via email to