Java 如何在没有SSL的情况下远程使用jmap?
我已将我的linux远程计算机(使用JRE 1.7)配置为使用jmx的必要属性执行java应用程序:Java 如何在没有SSL的情况下远程使用jmap?,java,ssl,java-7,jmx,remote-debugging,Java,Ssl,Java 7,Jmx,Remote Debugging,我已将我的linux远程计算机(使用JRE 1.7)配置为使用jmx的必要属性执行java应用程序: java -Dcom.sun.management.jmxremote \ -Dcom.sun.management.jmxremote.port=5005 \ -Dcom.sun.management.jmxremote.local.only=false \ -Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.manage
java -Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=5005 \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-jar myapplication.jar
现在,在我的windows本地计算机(其中有JDK 1.7)中,我想使用工具jmap,例如打印直方图:
jmap-历史10.218.72.227:5005
但它有以下错误:
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
Attaching to remote server 10.218.72.227:5005, please wait...
Error attaching to remote server: java.rmi.NotBoundException: Not bound: "SARemoteDebugger" (only bound name is "jmxrmi")
奇怪的是,我可以使用jconsole成功连接,但首先它会提示我不安全地重试连接(没有SSL):
因此,它似乎应该是jmap工作的某种标志,您知道如何克服这个问题吗?在
您首先需要将其连接到流程,以便能够远程使用jmap
下面的步骤说明了它的工作原理
用于所有Java进程(本地和远程)的Java版本
java版本“1.7.0_80”Java(TM)SE运行时环境(build 1.7.0_80-b15)
Java HotSpot(TM)服务器虚拟机(构建24.80-b11,混合模式) 在远程主机上执行
Attaching to remote server 42@10.218.72.227, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.80-b11
Iterating over heap. This may take a while...
Object Histogram:
num #instances #bytes Class description
--------------------------------------------------------------------------
1: 5575 527488 * ConstMethodKlass
2: 5575 493168 * MethodKlass
...
java-jarmyapplication.jar
rmi
rmiregistry-J-Xbootclasspath/p:$JAVA_HOME/lib/sajdi.jar&
jps
(例如12345)获取应用程序的PIDjsadebugd1234542
Attaching to remote server 42@10.218.72.227, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.80-b11
Iterating over heap. This may take a while...
Object Histogram:
num #instances #bytes Class description
--------------------------------------------------------------------------
1: 5575 527488 * ConstMethodKlass
2: 5575 493168 * MethodKlass
...
jmap
jmap-堆42@10.218.72.227
Attaching to remote server 42@10.218.72.227, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.80-b11
Iterating over heap. This may take a while...
Object Histogram:
num #instances #bytes Class description
--------------------------------------------------------------------------
1: 5575 527488 * ConstMethodKlass
2: 5575 493168 * MethodKlass
...
附加说明:手册页声明此实用程序不受支持,可能在未来版本的JDK中可用,也可能不可用
也许在远程机器上运行jmap(例如通过ssh)是一种更好的方法