Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA not Showing anything endpoints tab: "Failed to retrieve application JMX service URL"

I have a spring boot web service that I want to see the endpoints of. However when I run it in IntelliJ there are no endpoints displayed. In the endpoints window I see the error

Failed to check application ready state: AttachProvider for the vm is not found.
Press Refresh button to reinit ready state checking

I am able to run the application just fine and hit the web services fine with SoapUI, but I would like to use the functionality in IntelliJ. When I click the endpoint tab or the refresh button in the endpoint tab, in the event log I get a log entry on application start that says

PersonMicroserviceApplication: Failed to retrieve application JMX service URL

I have "Enable JMX agent" checked in the run configuration. This is my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>com.example.microservice</groupId>
    <artifactId>person-service</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.fasterxml.jackson.datatype</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.fasterxml.jackson.module</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.6</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>src/main/java</sourceDirectory>
        <testSourceDirectory>src/test/java</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

NOTE: Jackson is marked as a quarantined dependency at my company's maven repository due to a security concern (I'm not sure what the security concern is), so I am using gson as my json mapper, I have the following line in my application.properties to tell spring to use gson

spring.http.converters.preferred-json-mapper=gson

The only other thing I have in my application.properties is a connect string to mongodb. There is nothing else, so there may be something I'm missing there but in the spring documentation I saw it just said include spring-boot-starter-actuator and check enable JMX agent.

Is there anything I'm missing configuration-wise to enable this? I am on windows 10 64 bit, I am using oracles JDK 8.

like image 964
cjwillis48 Avatar asked Feb 28 '19 15:02

cjwillis48


People also ask

How do I find my JMX URL?

Select "Management>Create Server Connection..." from the menu. This will start "My Wizard". The connection to ServiceMix can be created using the wizard. The Server URL is service:jmx:rmi:///jndi/rmi://hostname:port/app_to_monitor .


1 Answers

I also encountered this problem and finally found the answer:

Starting from 2018.3.4 IntelliJ IDEA use local JMX connector for retrieving Spring Boot actuator endpoint's data. Local JMX monitoring has some restrictions, in particular, it isn't possible to get local JMX connector address if Spring Boot application and IntelliJ IDEA JVMs have different bitness. If it is not possible to run application on JVM with the same bitness, then, in order to fix the problem, one could 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

After setting:

enter image description here

jetbrains issue link:https://youtrack.jetbrains.com/issue/IDEA-204797

like image 147
liu903265 Avatar answered Sep 18 '22 11:09

liu903265