Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extending JCONSOLE functionality for client remote connections

Tags:

java

jmx

jconsole

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
like image 564
Loco234 Avatar asked Jun 08 '15 15:06

Loco234


People also ask

How does JConsole connect to remote process?

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.

What is JConsole and how do you use it?

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.

What is meant by JConsole?

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.


1 Answers

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.

like image 154
Loco234 Avatar answered Oct 12 '22 03:10

Loco234