InstanceAlreadyExistsException when creating Connections without start them

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

InstanceAlreadyExistsException when creating Connections without start them

Li, Fan
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 | Threaded
Open this post in threaded view
|

Re: InstanceAlreadyExistsException when creating Connections without start them

James Strachan-2
Which version of ActiveMQ are you using BTW? We did have some
JMX-related bugs a while back that have been fixed.  We now use
different MBean names for each transport connection so you shouldn't
receive this exception on 4.0-RC2 (I use JMX all the time with
multiple transports on the broker and haven't seen this in a long
while).

Incidentally if ever you're having trouble with JMX its very easy to
disable with the useJmx="false" property on BrokerService or <broker>

James

On 4/6/06, Li, Fan <[hidden email]> wrote:

> 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
>
>
>
>


--

James
-------
http://radio.weblogs.com/0112098/
Reply | Threaded
Open this post in threaded view
|

FW: InstanceAlreadyExistsException when creating Connections without start them

Li, Fan
In reply to this post by Li, Fan
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: '[hidden email]'
> 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 | Threaded
Open this post in threaded view
|

Re: FW: InstanceAlreadyExistsException when creating Connections without start them

James Strachan-2
On 4/6/06, Li, Fan <[hidden email]> wrote:
> 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.

Ah I see. I've committed your patch to SVN HEAD which should fix this
issue. I wonder, is your issue caused by running multiple brokers - or
is it multiple connectors clashing? No worries though, this issue
shouldn't occur again

--

James
-------
http://radio.weblogs.com/0112098/
Reply | Threaded
Open this post in threaded view
|

RE: FW: InstanceAlreadyExistsException when creating Connections without start them

Li, Fan
In reply to this post by Li, Fan
I am running only one broker and trying to make multiple connections to it. Thanks for commit the patch.

Fan

-----Original Message-----
From: James Strachan [mailto:[hidden email]]
Sent: Thursday, April 06, 2006 8:55 AM
To: [hidden email]
Subject: Re: FW: InstanceAlreadyExistsException when creating Connections without start them

On 4/6/06, Li, Fan <[hidden email]> wrote:
> 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.

Ah I see. I've committed your patch to SVN HEAD which should fix this issue. I wonder, is your issue caused by running multiple brokers - or is it multiple connectors clashing? No worries though, this issue shouldn't occur again

--

James
-------
http://radio.weblogs.com/0112098/