Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/400.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
连接Windows上的JConsole和Linux上的远程Java Springboot应用程序时失败_Java_Linux_Spring Boot_Jmx_Jconsole - Fatal编程技术网

连接Windows上的JConsole和Linux上的远程Java Springboot应用程序时失败

连接Windows上的JConsole和Linux上的远程Java Springboot应用程序时失败,java,linux,spring-boot,jmx,jconsole,Java,Linux,Spring Boot,Jmx,Jconsole,我在安装了Java 1.8的RHEL服务器上启动Java SpringBoot应用程序,并使用以下命令:- java -jar App.jar --spring.profiles.active=dev -Xms96m -Xmx128m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseG1GC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:loggc.log -Dcom.sun.management.jmxr

我在安装了Java 1.8的RHEL服务器上启动Java SpringBoot应用程序,并使用以下命令:-

java -jar App.jar --spring.profiles.active=dev -Xms96m -Xmx128m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseG1GC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:loggc.log 
-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=5901
-Dcom.sun.management.jmxremote.rmi.port=5901
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.local.only=false 
-Djava.rmi.server.hostname=localhost
jar成功启动后,分配了一个PID,我想监控该PID的堆利用率。因此,我试图通过在windows环境下使用JConsole来实现这一点,并使用putty将Linux上的JMX端口绑定到windows上的端口转发

但我无法成功连接,因为JRMP连接失败

有朝一日,我可以深入了解我可能做错了什么,或者是否有更好的方法来分析Linux环境中的堆利用率


我试图通过:jconsole 5901访问它,但它显示远程端点处的非JRMP服务器。

参数顺序错误。这些参数在main方法中作为args提供,但是Java运行时并不关心它们

java -h
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
如果顺序正确,Java运行时将拾取参数,而不是应用程序

java-Xms96m-Xmx128m-XX:+HeapDumpOnOutOfMemoryError-XX:+UseG1GC-XX:+PrintGCDetails-XX:+printgcdatastamps-Xloggc:loggc.log
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=5901
-Dcom.sun.management.jmxremote.rmi.port=5901
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.local.only=false
-Djava.rmi.server.hostname=localhost
-jar App.jar——spring.profiles.active=dev

谢谢,但现在收到一个不同的错误->我是否需要打开一个带有5901的tcp端口(如linux上提到的jmx端口),因为它显示错误:jmx连接器服务器通信错误:服务:jmx:rmi://ip:5901I 现在能够成功启动应用程序,并且jmx端口正在与windows绑定,但jconsole仍然无法连接。@Mangla为args
-Djava.rmi.server.hostname
指定您的IP地址,而不是locahost。(例如)
-Djava.rmi.server.hostname=192.168.8.252