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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -