[Fixed] IntelliJ IDEA not Showing anything endpoints tab: "Failed to retrieve application JMX service URL" – Java

Photo of author
Written By M Ibrahim
intellij-idea spring-boot

Quick Fix: When the application and IntelliJ IDEA JVMs have different bitness, add the following to Spring Boot run configuration’s VM options: -Dcom.sun.management.jmxremote.port={some_port} -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false

The Problem:

IntelliJ IDEA is failing to display endpoints in the endpoints tab and presents the error "Failed to retrieve application JMX service URL". The "Endpoints" tab shows the message "Failed to check application ready state: AttachProvider for the vm is not found. Press Refresh button to reinit ready state checking.". The issue persists despite having "Enable JMX agent" checked in the run configuration. The Spring Boot application uses Gson as the JSON mapper due to a security concern with Jackson, as specified in the application.properties file. The user has ensured that the necessary dependencies, such as spring-boot-starter-actuator and spring-boot-devtools, are included in the pom.xml file.

The Solutions:

Solution 1: Use local JMX connector

IntelliJ IDEA 2018.3.4 and later versions use a local JMX connector to retrieve Spring Boot actuator endpoint data. This approach has limitations, especially when the Spring Boot application and IntelliJ IDEA JVMs have different bitness. To resolve this issue, add the following to Spring Boot run configuration’s VM options:

-Dcom.sun.management.jmxremote.port={some_port} -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false

Afterward, navigate to Run > Edit Configurations > VM options, and add the above command as shown:

[Image of IntelliJ IDEA run configuration with VM options]

Refer to the JetBrains issue link for more information: https://youtrack.jetbrains.com/issue/IDEA-204797.

Solution 2: Set VM Options

\n

To resolve the issue of IntelliJ IDEA not displaying endpoints and showing the error "Failed to retrieve application JMX service URL," you can try setting the following VM option for your application:

-Djava.rmi.server.hostname=localhost

\n

This VM option specifies the hostname of the local machine where the application is running. It’s necessary for the proper communication between IntelliJ IDEA and the application’s JMX service.

\n

To set this VM option, follow these steps:

\n

    \n

  1. Open the Run Configuration dialog for your Spring Boot application in IntelliJ IDEA.
  2. \n

  3. Locate the "VM options" field in the "Run/Debug Configuration" tab.
  4. \n

  5. Add the following line to the "VM options" field:
    \n

    -Djava.rmi.server.hostname=localhost
    
  6. \n

  7. Click “Apply” and “OK” to save the changes.
  8. \n

\n

After setting this VM option, restart your application in IntelliJ IDEA. You should now be able to see the endpoints in the Endpoints tab without encountering the "Failed to retrieve application JMX service URL" error.

\n

This solution is based on the suggestion provided in the following issue tracker: https://youtrack.jetbrains.com/issue/IDEA-210665#focus=Comments-27-3544328.0-0

Solution 3: Update application.properties

To resolve the issue of IntelliJ IDEA not showing any endpoints and displaying the error “Failed to retrieve application JMX service URL,” you can modify your application.properties file.

Within your application.properties file, add the following line:

management.endpoints.web.exposure.include=*,info,env

This line specifies that all endpoints, including the info and env endpoints, should be exposed and visible in IntelliJ IDEA. After making this change, restart your application, and the endpoints should now be displayed in the Endpoints tab.

Once you’ve added this line, restart your application. After restarting, you should be able to see all endpoints in the Endpoints tab of IntelliJ IDEA.

Solution 4: Check Permissions of TMP Directory

To resolve the issue, check the permissions of the `TMP or TEMP` directory on your system (usually `%TMP%\hsperfdata_<username>` on Windows or `/tmp/hsperfdata_<username>` on Linux/macOS). Make sure that your user account has read and write permissions to this directory.

  1. Right-click on the `hsperfdata_<username>` directory and select “Properties”.
  2. Go to the “Security” tab and click on the “Edit” button.
  3. Click on the “Add” button and select your user account.
  4. Grant your user account “Read” and “Write” permissions.
  5. Click “OK” to save the changes.

Alternatively, you can also try deleting the `hsperfdata_<username>` directory and restarting your application. This will force IntelliJ IDEA to recreate the directory with the correct permissions.

Solution 5: Uncheck Enable JMX Agent

If you are using Oracle’s Java Development Kit (JDK) version 8, like me, you might face the issue of not being able to see endpoints in the Endpoints tab in IntelliJ IDEA. The error message you encounter might be “Failed to retrieve application JMX service URL.” To resolve this, uncheck the “Enable JMX Agent” option in the Run/Debug Configuration settings.

Here’s how you can do it:
1. Open your project in IntelliJ IDEA.
2. Click the “Run” button or press “Ctrl + Shift + F10” (Windows) or “Cmd + Shift + F10” (Mac) to open the Run/Debug Configurations dialog box.
3. In the left pane, select the configuration you want to modify.
4. In the right pane, uncheck the “Enable JMX Agent” checkbox under the “JMX” section.
5. Click “Apply” and then “OK” to save the changes.

After unchecking the “Enable JMX Agent” option, try running your application again. You should now be able to see the endpoints in the Endpoints tab in IntelliJ IDEA.

Note: This solution might work for you if you are using Java 1.8. If you are using a different version of Java, there might be a different solution for you.

I hope this resolves your issue!