Search code examples
javajmxjconsole

Extending JCONSOLE functionality for client remote connections


I have a simple JMX application that has exposed MBeans based on this tutorial

Is it possible to launch this application with a custom class in the classpath that extends JCONSOLE, so that when a client tries to access it remotely the extended jconsole window opens?

So for example, I create a simple application and package it in MyApp.jar. Then I run it with the following commands in the cmd:

java -classpath JconsoleExtension.jar;MyApp.jar 
-com.sun.management.jmxremote.login.config=management.properties 
-Djava.security.auth.login.config=./sample_jaas.config 
com.test.running.RunningImplementation

With managepement.properties looking something like this:

com.sun.management.jmxremote=true
com.sun.management.jmxremote.port=1234
com.sun.management.jmxremote.login.config=Sample

Is it possible for a client to connect remotely using:

jconsole hostname:1234

And pull up the jconsole window with the extended functionality?

Or, would the client have to reference the extension when trying to connect, so something like:

 jconsole hostname:1234 -classpath JconsoleExtension.jar

Solution

  • It looks as if JConsole can't be extended on the server side. The extension needs to be called from the client side, and as such they'd need to have access to the .jar where it's extended.