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
To connect JConsole to server process, in the Remote Process section, specify the URL service:jmx:rmi:///jndi/rmi://localhost:2047/fmq and credentials pertaining to the server. Default user name and password are admin and passwd respectively.
You can use JConsole to connect to a running Java virtual machine, and then monitor the memory usage and thread activity. You can obtain class-loading information, plus information on the JVM and the operating system.
JConsole (Java™ Monitoring and Management Console) is a graphical tool that allows the user to monitor and manage the behavior of Java applications. Note: Because JConsole consumes significant system resources, Oracle recommend its use only in development environments for creating prototypes.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With