There's RMIConnector instance registered to JNDI service w/ lookup name "jmx:<machine name>:rmi". Using that instance, I can invoke any MBean operations. It works fine from remote client where it can instanciate RMIClientConnectorImpl. (internally, it looks up for the RMIConnector through JNDI.)
Now... I want to do the same thing from EJB bean impl. But, I'm getting ClassNotFound error for the RMIConnector class type where RMIConnector is from lib/ext/jboss.jar.
I believe that there's unique classloader assigned to each ejb.jar, war.jar, or ear.jar. Though, I don't know where it's parent classloader comes from. (Maybe from MLet to load bootstrap services?) Since jboss.jar is loaded by ClassPathExtension MBean (internally, it uses MLet), jboss.jar is loaded from different classloader.
How can I enable the EJB bean to acess the class from jboss.jar?
or... is there any other way EJB bean can use MBean service?
Your help is greately appreciated.
Great. It works now.
MBeanServer server = (MBeanServer) MBeanServerFactory.findMBeanServer(null).iterator().next();
Then, invoke through the server works fine.
The MBeanServerFactory came from lib/jmxri.jar, and somehow it can access jars from lib/ext. But, from EJB, it cannot access the jars from lib/ext. How is that possible?