无法将JConsole连接到在Docker容器中运行的Springboot应用程序

时间:2019-12-16 15:52:09

标签: spring-boot docker jconsole

我有一个已成功部署在Docker容器中的Springboot应用程序,我正在尝试将JConsole连接到它。在容器内,正在使用以下标志执行应用程序:

-Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname="$JMX_RMI_SERVER_HOST"
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=10122
-Dcom.sun.management.jmxremote.rmi.port=10122

其中JMX_RMI_SERVER_HOST=$(hostname -i)

在我的Dockerfile中,我有EXPOSE 10122,在我的撰写10122:10122的端口部分。

JConsole最有可能无法连接到localhost:10122,因为我在日志中看到了以下警告:

15:40:35.896 [RMI TCP Accept-0] [] [] [] WARN  sun.rmi.transport.tcp - RMI TCP Accept-0: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,localport=44567] throws
java.net.SocketTimeoutException: Accept timed out
    at java.base/java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.base/java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:458)
    at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:551)
    at java.base/java.net.ServerSocket.accept(ServerSocket.java:519)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:394)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:366)
    at java.base/java.lang.Thread.run(Thread.java:834)
15:40:35.896 [RMI TCP Accept-10122] [] [] [] WARN  sun.rmi.transport.tcp - RMI TCP Accept-10122: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,localport=10122] throws
java.net.SocketTimeoutException: Accept timed out
    at java.base/java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.base/java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:458)
    at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:551)
    at java.base/java.net.ServerSocket.accept(ServerSocket.java:519)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:394)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:366)
    at java.base/java.lang.Thread.run(Thread.java:834)

有人知道我在想什么吗?谢谢您的帮助

0 个答案:

没有答案