This tutorial will show you how to access Endpoints via JMX in Spring Boot Actuator. As we know only /actuator/health and /actuator/info are accessible over HTTP protocol for security reasons. Therefore if you want to access
other end points you have to access over JMX.
JMX console comes with the JDK installation, so you don’t have to install any special software. Below we will see how to start JMX (JConsole) and access Spring Boot end points, such as, /actuator/beans, /actuator/auditevents etc. over JMX.
First go through the example Spring Boot Actuator – Production Ready Features
Starting JConsole (JMX)
JMX (Java Monitoring and Management Console) can be found under JDK_HOME/bin directory. To start the Jconsole navigate to the directory JDK_HOME/bin and execute command jconsole.exe in command prompt as shown in the below image:
Once you execute the above command in command prompt, below popup opens:
Now select com.jeejava.springboot.actuator.main.ActuatorApplication under Local Process and click on Connect button.
If you face problem – Secure connection failed. Retry insecurely?, then ignore the error and click on Insecure connection button to connect again. You will get to see similar to below window:
Accessing Endpoints via JMX
Now click on MBeans tab as shown in the below image and you will find the number of end points under package org.springframework.boot on left side tree:
Now you can select endpoint on left side tree and check details for each endpoint on right side.
Let’s say you want to see the details for Beans end point. So click on Beans -> Operations -> beans on left tree.
Then you will find java.util.Map along with beans button on top of Operation invocation window on right side.
If you click on beans button then you will get a window called Operation return value as shown in the below image by arrow but you won’t be able to see details as it is a tiny window.
Therefore to see details about beans just select all inside the Operation return value window by pressing Ctrl+a from the keyboard and paste it into Notepad++. You will find below details in the Notepad++ as shown below image:
Even the whole content is not shown in the above image, practically you will have much more content than what I have shown here.
So here we have seen how to access a particular end point over JMX.
If you want to disconnect the JMX console, just click the green button as shown below image:
Thanks for reading.