[英]Spring Boot @ManagedResource component is not visible in VisualVM when launched in Docker but works locally
The issue is very straightforward to reproduce.这个问题很容易重现。 I have a Spring component:我有一个 Spring 组件:
@Component
@ManagedResource
public class EncryptionUtil {
...
@ManagedOperation
public String encrypt(String plain) {
...
}
@ManagedOperation
public String decrypt(String encrypted) {
...
}
}
When I launch the app locally (using IDE) and connecting over JMX using VisualVM I can see and manage the bean:当我在本地启动应用程序(使用 IDE)并使用VisualVM通过 JMX 连接时,我可以查看和管理 bean:
But, when I launch the app in a container (locally as well), I do not see the bean.但是,当我在容器中(也在本地)启动应用程序时,我看不到 bean。 Moreover, I do not see any Spring related managing facilities as well:此外,我也没有看到任何与 Spring 相关的管理设施:
Here is my JMX opts that I pass into Dockerfile entrypoint when launchign the JAR file within:这是我在启动 JAR 文件时传入 Dockerfile 入口点的 JMX 选项:
JMX_OPTS="-Dcom.sun.management.jmxremote=true\
-Dcom.sun.management.jmxremote.local.only=false\
-Dcom.sun.management.jmxremote.authenticate=false\
-Dcom.sun.management.jmxremote.ssl=false\
-Djava.rmi.server.hostname=$DOCKER_HOST_IP\
-Dserver.port=$PORT\
-Dcom.sun.management.jmxremote.port=9090\
-Dcom.sun.management.jmxremote.rmi.port=9090"
DOCKER_HOST_IP=127.0.0.1
when launch locally obviously. DOCKER_HOST_IP=127.0.0.1
显然在本地启动时。
So issue, that MBeans are not recognized in a container at all.所以问题是,容器中根本无法识别 MBean。
Any idea folks?大家有什么想法吗? Thanks谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.