It looks like you didn't specify a right ObjectName for the route.
Here is an example:
ObjectName onFoo =
ObjectName.getInstance("org.apache.camel:context=localhost/camel-1,type=routes,name=\"foo\"");
--
Willem Jiang
FuseSource
Web: http://www.fusesource.com (http://www.fusesource.com/)
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
(English)
http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: willemjiang
On Friday, August 24, 2012 at 2:31 AM, dmhatre wrote:
> Hi Folks,
> I am trying to build a JMX client to monitor/manage camel
> routes,processors etc. I can see the
> mbeans in jconsole but want some remote jmx client to monitor camel. I am
> able to connect to the mbeanserver but get exception when calling the
> operations on Mbean
>
> NOTE: Running CAMEL as standalone java application
>
> *Error:*
> javax.management.InstanceNotFoundException:
> org.apache.camel:context=Darpan-HP/myCamel,type=routes,name=usaa-open-loans
> at
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1094)
> at
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getClassLoaderFor(DefaultMBeanServerInterceptor.java:1438)
> at
> com.sun.jmx.mbeanserver.JmxMBeanServer.getClassLoaderFor(JmxMBeanServer.java:1276)
> at
> javax.management.remote.rmi.RMIConnectionImpl$5.run(RMIConnectionImpl.java:1326)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> javax.management.remote.rmi.RMIConnectionImpl.getClassLoaderFor(RMIConnectionImpl.java:1323)
> at
> javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:771)
> at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:303)
> at sun.rmi.transport.Transport$1.run(Transport.java:159)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
> at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:662)
> at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown
> Source)
> at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
> at sun.rmi.server.UnicastRef.invoke(Unknown Source)
> at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
> at javax.management.remote.rmi.RMIConnectionImpl_Stub.invoke(Unknown
> Source)
> at
> javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(Unknown
> Source)
> at javax.management.MBeanServerInvocationHandler.invoke(Unknown Source)
> at $Proxy0.suspend(Unknown Source)
> at JMXClientTest.main(JMXClientTest.java:44)
>
> *Below are few lines from my camel-context.xml*
>
> <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring">
> <jmxAgent id="agent" createConnector="true" usePlatformMBeanServer="true"
> registryPort="8000" />
>
> *Below is the code for jmx client also a standalone java application.*
>
> JMXServiceURL url = null;
> ManagedSuspendableRouteMBean mbeanProxy = null;
> try {
> url = new
> JMXServiceURL("service:jmx:rmi:///jndi/rmi://Darpan-HP:8000/jmxrmi/camel");
> } catch (MalformedURLException e) {
> e.printStackTrace();
> }
> try {
> JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
> MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
> try {
> ObjectName mbeanName = new ObjectName(
> "org.apache.camel:context=Darpan-HP/myCamel,type=routes,name=usaa-open-loans");
>
>
> mbeanProxy = JMX.newMBeanProxy(mbsc, mbeanName,
> ManagedSuspendableRouteMBean.class, true);
> } catch (MalformedObjectNameException e) {
> e.printStackTrace();
> } catch (NullPointerException e) {
> e.printStackTrace();
> }
>
> try {
> mbeanProxy.suspend();
> System.out.println("########## Route suspended ##########");
> Thread.sleep(30000);
> mbeanProxy.resume();
> System.out.println("########## Route resumed ##########");
> } catch (Exception e) {
> e.printStackTrace();
> }
> } catch (IOException e) {
> e.printStackTrace();
> }
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Help-with-JMX-client-to-monitor-manage-camel-routes-processors-etc-tp5717967.html
> Sent from the Camel - Users mailing list archive at Nabble.com
> (http://Nabble.com).