jmx - InvocationException on connecting to MBean server from Spring -
i trying connect mbean server spring application. below code:
public void connect() throws exception { mbeanserverconnectionfactorybean bean = new mbeanserverconnectionfactorybean(); bean.setconnectonstartup(false); properties environment = new properties(); environment.put("java.naming.factory.initial", "com.sun.jndi.rmi.registry.registrycontextfactory"); environment.put("java.naming.provider.url", "rmi://117.13.128.104:9308"); environment.put("jmx.remote.jndi.rebind", "true"); bean.setenvironment(environment); bean.setserviceurl("service:jmx:rmi://117.13.128.104/jndi/rmi://117.13.128.104:9308/agent/eodserver"); bean.afterpropertiesset(); mbeanserverconnection server = (mbeanserverconnection)bean.getobject(); system.out.println("test"); // after bean.getobject() - debug pointer on line. }
the debug pointer set after bean.getobject() method call.
on debugging above code, getting below value mbeanserverconnection server:
com.sun.jdi.invocationexception occurred invoking method.
values of environment , serviceurl of mbeanserverconnectionfactorybean set correctly why it's not connecting mbean server?
i'm not familiar particular utility, looks there weird overlap between jndi , jmx configurations. why don't simplify , use jdk's own jmxconnectorfactory ?
import javax.management.*; import javax.management.remote.*; ... jmxconnector connector = jmxconnectorfactory.connect("service:jmx:rmi://117.13.128.104/jndi/rmi://117.13.128.104:9308/agent/eodserver"); mbeanserverconnection connection = connector.getmbeanserverconnection();
technically, if need to, can add environment map mix using:
jmxconnector connector = jmxconnectorfactory.connect("service:jmx:rmi://117.13.128.104/jndi/rmi://117.13.128.104:9308/agent/eodserver", environment);
...but seems me environment using implied default connector , contents of jmxserviceurl.
Comments
Post a Comment