How to make an application like JConsole?

232 Views Asked by At

I want to make an application like JConsole. Is it possible? If yes, what are the changes need to done at JVM level? I am planning to use Spring-Boot. As per my knowledge, JMX is enabled by default. Do I need to configure anything extra in my Spring-Boot app in order to access the JMXBeans which are exposed by default?

Here I'm not trying to expose any MBean instead I'm trying to access those beans which are already exposed by JVM. How to achieve it?

1

There are 1 best solutions below

0
On

JConsole is a JMX compliant monitoring and management application. The architecture is quite simple. It's a client-server architecture. Where the client is the Remote application (Example JConsole or the one that you want to build) and the server is the JMX Agent. In your case, you want to build your own client which is possible.

I want to make an application like JConsole. Is it possible?

Yes, it is possible.

If yes, what are the changes need to done at JVM level?

What do you mean by changes at JVM level? You are simply creating a client application that connects to the server (JMX Agent) using a certain protocol. Remote Method Invocation (RMI) is the protocol used by JConsole for the connection to the JMX Agent. If you want to use RMI for communication, you don't have to do anything on the server side. But if you want to use some other protocol for communication, you can define your own Protocol adapter.

As per my knowledge, JMX is enabled by default.

As of Java SE 6 it is. But you can only monitor it locally. For connection from a remote machine, you need to define an RMI port to start listening for incoming connections.

Here I'm not trying to expose any MBean instead I'm trying to access those beans which are already exposed by JVM. How to achieve it?

Please check out the example from this link - Mimicking Out-of-the-Box Management Using the JMX Remote API. It shows you how to create a simple client application that connects to a remote JMX agent and access the MBeans. This should guide you in the right direction.