gpt4 book ai didi

java - JMX 从 kubernetes pod 转发不同端口

转载 作者:行者123 更新时间:2023-12-02 01:51:13 37 4
gpt4 key购买 nike

我在将 jmx 从 kubernetes pod 转发到本地主机时遇到问题。当端口转发到同一端口时,一切正常:

kubectl port-forward ... 9010:9010 OR
kubectl port-forward ... 9010

但是,当我尝试转发到不同的本地端口时,

kubectl port-forward ... 9011:9010

jconsole 或 jms 都无法连接。

它阻止我同时分析多个应用程序。

JMS 错误:

com.oracle.jmc.rjmx.ConnectionException caused by java.rmi.NoSuchObjectException: no such object in table
at com.oracle.jmc.rjmx.internal.RJMXConnection.connect(RJMXConnection.java:406)
at com.oracle.jmc.rjmx.internal.ServerHandle.doConnect(ServerHandle.java:88)
at com.oracle.jmc.rjmx.internal.ServerHandle.connect(ServerHandle.java:78)
at com.oracle.jmc.console.ui.editor.internal.ConsoleEditor$ConnectJob.run(ConsoleEditor.java:73)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.rmi.NoSuchObjectException: no such object in table
at java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:283)
at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:260)
at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
at java.management.rmi/javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown Source)
at java.management.rmi/javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2105)
at java.management.rmi/javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:321)
at com.oracle.jmc.rjmx.internal.RJMXConnection.connectJmxConnector(RJMXConnection.java:451)
at com.oracle.jmc.rjmx.internal.RJMXConnection.establishConnection(RJMXConnection.java:427)
at com.oracle.jmc.rjmx.internal.RJMXConnection.connect(RJMXConnection.java:399)
... 4 more

jconsole 错误:

Connection to localhost:9011 did no succeed.

最佳答案

这是一个 RMI 问题。问题在于,交付给 JMX 客户端的 RMI stub 是为 9010 创建的,因此在尝试连接 9011 时会失败。概述了几个不错的解决方案 here 。另一种选择是切换到 JMXMP这是一个纯套接字 JMX 协议(protocol),因此端口转发无需任何其他解决方法即可工作。

关于java - JMX 从 kubernetes pod 转发不同端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52968961/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com