Java IntelliJ IDEA 未显示任何端点选项卡:“无法检索应用程序 JMX 服务 URL”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/54929656/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IntelliJ IDEA not Showing anything endpoints tab: "Failed to retrieve application JMX service URL"
提问by cjwillis48
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
我有一个 Spring Boot Web 服务,我想查看其端点。但是,当我在 IntelliJ 中运行它时,没有显示端点。在端点窗口中,我看到错误
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
我能够很好地运行应用程序并使用 SoapUI 很好地访问 Web 服务,但我想使用 IntelliJ 中的功能。当我单击端点选项卡或端点选项卡中的刷新按钮时,在事件日志中,我在应用程序启动时收到一个日志条目,上面写着
PersonMicroserviceApplication: Failed to retrieve application JMX service URL
I have "Enable JMX agent" checked in the run configuration. This is my pom.xml
我在运行配置中选中了“启用 JMX 代理”。这是我的 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.Hymanson.core</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.Hymanson.datatype</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.Hymanson.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: Hymanson 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
注意:由于安全问题,Hymanson 在我公司的 maven 存储库中被标记为隔离依赖项(我不确定安全问题是什么),所以我使用 gson 作为我的 json 映射器,我的应用程序中有以下行.properties 告诉 spring 使用 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.
我的 application.properties 中唯一的另一件事是连接到 mongodb 的字符串。没有别的了,所以可能我在那里遗漏了一些东西,但在 spring 文档中我看到它只是说包含 spring-boot-starter-actuator 并检查启用 JMX 代理。
Is there anything I'm missing configuration-wise to enable this? I am on windows 10 64 bit, I am using oracles JDK 8.
我在配置方面缺少什么来启用它吗?我在 Windows 10 64 位上,我使用的是 oracles JDK 8。
回答by liu903265
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:
从 2018.3.4 IntelliJ IDEA 开始使用本地 JMX 连接器来检索 Spring Boot 执行器端点的数据。本地 JMX 监控有一些限制,特别是如果 Spring Boot 应用程序和 IntelliJ IDEA JVM 的位数不同,则无法获取本地 JMX 连接器地址。如果无法以相同的位数在 JVM 上运行应用程序,那么为了解决该问题,可以将以下内容添加到 Spring Boot 运行配置的 VM 选项中:
-Dcom.sun.management.jmxremote.port={some_port} -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
After setting:
设置后:
jetbrains issue link:https://youtrack.jetbrains.com/issue/IDEA-204797
jetbrains 问题链接:https://youtrack.jetbrains.com/issue/IDEA-204797