Nikos
Nikos

Reputation: 7552

Connecting to Mule's JMX output from Java

What is the standard way to connect to Mules JMX output through a standard java program,

I'm trying something like this but looking at the source of Mules SimplePasswordJmxAuthenticator, I need to supply auth tokens to mule so perhaps there is a better lib to use for sending jmx requests?

url1 = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1198/server");
JMXConnector jmxc = JMXConnectorFactory.connect(url1); 

Upvotes: 0

Views: 402

Answers (1)

Nicholas
Nicholas

Reputation: 16056

I'm not familiar with the details of Mule's JMX server, but here's how you could add credentials to your code snippet:

url1 = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1198/server");
String[] credentials = new String[]{"myusername", "mypassword"};
Map<String, Object> env = new HashMap<String, Object>(1);
env.put(javax.management.remote.JMXConnector.CREDENTIALS, credentials);
JMXConnector jmxc = JMXConnectorFactory.connect(url1, env); 

That's the standard JMXRemoting way of doing it. Perhaps it will work for you.

Upvotes: 1

Related Questions