I tried the following on GlassFish Server Open Source Edition 4.0 (build 89)
AppserverConnectionSource acs = new AppserverConnectionSource(AppserverConnectionSource.PROTOCOL_RMI, "localhost", Integer.parseInt(Settings.JMX_PORT), "admin", _password, null);
MonitoringDottedNames mn = acs.getDomainRoot().getMonitoringDottedNames();
and I get the following exception:
Caused by: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException: management/rmi-jmx-connector
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:357)
at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:267)
at com.sun.appserv.management.client.AppserverConnectionSource.createNew(AppserverConnectionSource.java:409)
at com.sun.appserv.management.client.AppserverConnectionSource.getJMXConnector(AppserverConnectionSource.java:472)
at com.sun.appserv.management.client.AppserverConnectionSource.getMBeanServerConnection(AppserverConnectionSource.java:501)
at com.sun.appserv.management.client.ProxyFactory.getInstance(ProxyFactory.java:435)
... 166 more
Caused by: javax.naming.NameNotFoundException: management/rmi-jmx-connector
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:116)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:203)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1924)
at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1891)
at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:274)
... 171 more
Further, I notice that AppserverConnectionSource.java has hard-coded JMX URL ending with "management/rmi-jmx-connector"
whereas the Glassfish has JMX listener running on "/jndi/rmi://localhost:8686/jmxrmi".
So there is a mismatch between the two.
Is this a bug? Any work-arounds?
I can connect using the standard JMX methods, but not using AppserverConnectionSource which I would prefer because
I'd like to use the MonitoringDottedNames.