Cannot create JMX connector

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

Cannot create JMX connector

tan
Hi,

I have problems creating a jmx connector for remote monitoring. I tried putting -Dorg.apache.camel.jmx.createRmiConnector=true in the VM arguments, as well as adding the rmi connector inside the code as below:

     DefaultManagementAgent agent = new DefaultManagementAgent(camelContext);
     agent.setCreateConnector(true);
     agent.setServiceUrlPath("service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/camel");
     camelContext.getManagementStrategy().setManagementAgent(agent);

But both of them produced the below errors:

[ WARN] [Camel Thread 0 - JMXConnector: service:jmx:rmi:///jndi/rmi://PC_NAME:1099/jmxrmi/camel] (DefaultManagementAgent.java:430) - Could not start JMXConnector thread.
java.io.IOException: Cannot bind to URL [rmi://PC_NAME:1099/jmxrmi/camel]: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: PC_NAME; nested exception is:
        java.net.ConnectException: Connection refused: connect]
        at javax.management.remote.rmi.RMIConnectorServer.newIOException(Unknown Source)
        at javax.management.remote.rmi.RMIConnectorServer.start(Unknown Source)
        at org.apache.camel.management.DefaultManagementAgent$1.run(DefaultManagementAgent.java:428)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: PC_NAME; nested exception is:
        java.net.ConnectException: Connection refused: connect]
        at com.sun.jndi.rmi.registry.RegistryContext.bind(Unknown Source)
        at com.sun.jndi.toolkit.url.GenericURLContext.bind(Unknown Source)
        at javax.naming.InitialContext.bind(Unknown Source)
        at javax.management.remote.rmi.RMIConnectorServer.bind(Unknown Source)
        ... 5 more
Caused by: java.rmi.ConnectException: Connection refused to host: PC_NAME; nested exception is:
        java.net.ConnectException: Connection refused: connect
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
        at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
        at sun.rmi.server.UnicastRef.newCall(Unknown Source)
        at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
        ... 9 more
Caused by: java.net.ConnectException: Connection refused: connect
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(Unknown Source)
        at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
        ... 14 more

I tried searching but can't seem to find any similar issues. Can someone help me on this? Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: Cannot create JMX connector

Claus Ibsen-2
Hi

Have you tried with just only setting create connector = true


On Tue, Dec 14, 2010 at 8:24 AM, tan <[hidden email]> wrote:

>
> Hi,
>
> I have problems creating a jmx connector for remote monitoring. I tried
> putting -Dorg.apache.camel.jmx.createRmiConnector=true in the VM arguments,
> as well as adding the rmi connector inside the code as below:
>
>     DefaultManagementAgent agent = new
> DefaultManagementAgent(camelContext);
>     agent.setCreateConnector(true);
>
> agent.setServiceUrlPath("service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/camel");
>     camelContext.getManagementStrategy().setManagementAgent(agent);
>
> But both of them produced the below errors:
>
> [ WARN] [Camel Thread 0 - JMXConnector:
> service:jmx:rmi:///jndi/rmi://PC_NAME:1099/jmxrmi/camel]
> (DefaultManagementAgent.java:430) - Could not start JMXConnector thread.
> java.io.IOException: Cannot bind to URL [rmi://PC_NAME:1099/jmxrmi/camel]:
> javax.naming.ServiceUnavailableException [Root exception is
> java.rmi.ConnectException: Connection refused to host: PC_NAME; nested
> exception is:
>        java.net.ConnectException: Connection refused: connect]
>        at javax.management.remote.rmi.RMIConnectorServer.newIOException(Unknown
> Source)
>        at javax.management.remote.rmi.RMIConnectorServer.start(Unknown Source)
>        at
> org.apache.camel.management.DefaultManagementAgent$1.run(DefaultManagementAgent.java:428)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>        at java.lang.Thread.run(Unknown Source)
> Caused by: javax.naming.ServiceUnavailableException [Root exception is
> java.rmi.ConnectException: Connection refused to host: PC_NAME; nested
> exception is:
>        java.net.ConnectException: Connection refused: connect]
>        at com.sun.jndi.rmi.registry.RegistryContext.bind(Unknown Source)
>        at com.sun.jndi.toolkit.url.GenericURLContext.bind(Unknown Source)
>        at javax.naming.InitialContext.bind(Unknown Source)
>        at javax.management.remote.rmi.RMIConnectorServer.bind(Unknown Source)
>        ... 5 more
> Caused by: java.rmi.ConnectException: Connection refused to host: PC_NAME;
> nested exception is:
>        java.net.ConnectException: Connection refused: connect
>        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
>        at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
>        at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
>        at sun.rmi.server.UnicastRef.newCall(Unknown Source)
>        at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
>        ... 9 more
> Caused by: java.net.ConnectException: Connection refused: connect
>        at java.net.PlainSocketImpl.socketConnect(Native Method)
>        at java.net.PlainSocketImpl.doConnect(Unknown Source)
>        at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>        at java.net.PlainSocketImpl.connect(Unknown Source)
>        at java.net.SocksSocketImpl.connect(Unknown Source)
>        at java.net.Socket.connect(Unknown Source)
>        at java.net.Socket.connect(Unknown Source)
>        at java.net.Socket.<init>(Unknown Source)
>        at java.net.Socket.<init>(Unknown Source)
>        at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown
> Source)
>        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown
> Source)
>        ... 14 more
>
> I tried searching but can't seem to find any similar issues. Can someone
> help me on this? Thanks in advance.
> --
> View this message in context: http://camel.465427.n5.nabble.com/Cannot-create-JMX-connector-tp3304153p3304153.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
Claus Ibsen
-----------------
FuseSource
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
tan
Reply | Threaded
Open this post in threaded view
|

Re: Cannot create JMX connector

tan
hi Claus Ibsen-2,

thanks for the reply. I have tried using agent.setCreateConnector(true) only, but still got the same error. Just a summary, I have tried:

1. agent.setCreateConnector(true) only
2. -Dorg.apache.camel.jmx.createRmiConnector=true only
3. -Dorg.apache.camel.jmx.createRmiConnector=true + agent.setCreateConnector(true)

All 3 methods gave me the same exception..
tan
Reply | Threaded
Open this post in threaded view
|

Re: Cannot create JMX connector

tan
Btw I'm using Camel 2.4.0
Reply | Threaded
Open this post in threaded view
|

Re: Cannot create JMX connector

Claus Ibsen-2
Maybe try using a different port number than the default, which may
already be taken by someone else.
And try Camel 2.5.0 also.


On Thu, Dec 16, 2010 at 7:12 AM, tan <[hidden email]> wrote:
>
> Btw I'm using Camel 2.4.0
> --
> View this message in context: http://camel.465427.n5.nabble.com/Cannot-create-JMX-connector-tp3304153p3307457.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
Claus Ibsen
-----------------
FuseSource
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
tan
Reply | Threaded
Open this post in threaded view
|

Re: Cannot create JMX connector

tan
Thanks! Indeed the port was taken by JBoss.. I used a different port and it's working now.