I'm working on integrating OSGi system tests with AS7 and as part of that we need to support remote deployment. Remote deployment that these tests do happens through JMX via a (OSGi-standardized) JMX API. To be able to do this I need to create a javax.management.remote.JMXConnectorServer.
So I was experimenting with adding this to jboss-as-jmx.
The following code works in a standlone program (never mind the hardcoded numbers and URL):
Registry rmiRegistry = LocateRegistry.createRegistry(9999);
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9999/server");
JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
cs.start();
However when I run this code in AS I get the following exception:
java.io.IOException: Cannot bind to URL rmi://localhost:9999/server:
javax.naming.NameNotFoundException: Name 'rmi:' not found in context '/localhost:9999'
Should I use a different type of URL in AS? Maybe not using RMI? Anyone know how I can create a JMXConnectorServer in AS?