Forum Home » Fuse Distributions » Fuse Services Framework

Thread: Karaf JMX access

 

Permlink Replies: 6 - Last Post: May 28, 2012 12:52 PM Last Post By: isakovarseniy
isakovarseniy

Posts: 8
Registered: 09/12/09
Karaf JMX access
Posted: May 24, 2012 5:42 PM
  Click to reply to this thread Reply
Hello
I am trying to create JMX client for servicemix. But I am getting error.
Do you have any suggestions?

Thanks

javax.management.InstanceNotFoundException: org.apache.karaf:type=features,name=trun
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.addNotificationListeners(RMIConnectionImpl.java:946)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
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(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl_Stub.addNotificationListeners(Unknown Source)
at javax.management.remote.rmi.RMIConnector.addListenersWithSubjects(RMIConnector.java:570)
at javax.management.remote.rmi.RMIConnector.addListenerWithSubject(RMIConnector.java:545)
at javax.management.remote.rmi.RMIConnector.access$700(RMIConnector.java:103)
at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.addNotificationListener(RMIConnector.java:1205)
at com.jibestream.jmx.ApplicationManagerImpl.createFeaturesServiceMBeanProxy(ApplicationManagerImpl.java:60)
at com.jibestream.jmx.test.Client.main(Client.java:37)

ffang

Posts: 1,320
Registered: 12/24/07
Re: Karaf JMX access
Posted: May 24, 2012 11:43 PM   in response to: isakovarseniy in response to: isakovarseniy
  Click to reply to this thread Reply
Hi,

Please tell us what's exact Servicemix/Fuse ESB version, how you connect JMX, what the JMX url/username/password you're using.

Freeman
isakovarseniy

Posts: 8
Registered: 09/12/09
Re: Karaf JMX access
Posted: May 25, 2012 1:31 PM   in response to: ffang in response to: ffang
  Click to reply to this thread Reply
Hi,

servicemix version 4.4.1
String jmxURL = "service:jmx:rmi://localhost:44444/jndi/rmi://localhost:1099/karaf-root";
String user = "smx";
String passwd = "smx";

 public FeaturesServiceMBean createFeaturesServiceMBeanProxy(
MBeanServerConnection mbsc) throws MalformedObjectNameException,
NullPointerException, InstanceNotFoundException, IOException {

echo("\n>>> Create FeatureService MBean <<<");
ObjectName mbeanName = new ObjectName(
"org.apache.karaf:type=features,name=trun");
FeaturesServiceMBean featuresServiceMBeanProxy = JMX.newMBeanProxy(
mbsc, mbeanName, FeaturesServiceMBean.class, true);

echo("\n>>> Add notification listener to FeatureService MBean <<<");
mbsc.addNotificationListener(mbeanName, clientListener, null, null);

return featuresServiceMBeanProxy;
}
Exception happens when I am adding NotificationListener

Thanks
Arseniy Isakov

ffang

Posts: 1,320
Registered: 12/24/07
Re: Karaf JMX access
Posted: May 28, 2012 12:50 AM   in response to: isakovarseniy in response to: isakovarseniy
  Click to reply to this thread Reply
Hi,

Did you test to use jconsole on that machine to see if jconsole works?

Freeman
isakovarseniy

Posts: 8
Registered: 09/12/09
Re: Karaf JMX access
Posted: May 28, 2012 12:40 PM   in response to: ffang in response to: ffang
  Click to reply to this thread Reply
Is works with jconsole
ffang

Posts: 1,320
Registered: 12/24/07
Re: Karaf JMX access
Posted: May 28, 2012 12:51 PM   in response to: isakovarseniy in response to: isakovarseniy
  Click to reply to this thread Reply
Hi,

Seems the ObjectName org.apache.karaf:type=features,name=trun isn't correct, could you double check it with JConsole?

Freeman
isakovarseniy

Posts: 8
Registered: 09/12/09
Re: Karaf JMX access
Posted: May 28, 2012 12:52 PM   in response to: isakovarseniy in response to: isakovarseniy
  Click to reply to this thread Reply
I found the problem
My mistake. it should be
org.apache.karaf:type=features,name=root.

Thank you very much. I found solution form jconsole

Regards
Arseniy Isakov