Is it possible to register a MBean dynamically? If yes, how?
I tried to use:
MBeanServer server = null; Context c = new InitialContext(); RMIAdaptor a = (RMIAdaptor)c.lookup("jmx/rmi/RMIAdaptor"); server = new RMIConnectorImpl(a); ObjectName tpMBeanName = new ObjectName("myapp:service=myservice"); server.registerMBean(inMBean, tpMBeanName);
org.jboss.util.NestedRuntimeException: error marshalling arguments; nested exception is:
You cannot pass in a mbean for registration from another vm. You would have to use the createMBean method to create and register the mbean in question.