Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/379.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在没有SSL的情况下远程使用jmap?_Java_Ssl_Java 7_Jmx_Remote Debugging - Fatal编程技术网

Java 如何在没有SSL的情况下远程使用jmap?

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

我已将我的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.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)获取应用程序的PID
  • 将调试demon附加到应用程序
    jsadebugd1234542
  • 在本地主机上执行

    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)是一种更好的方法