在生产环境中连接 jmx 时出错

Error while connecting jmx on Production

出于某种原因,我无法使用 VisualVM 在生产服务器上连接 java pid。

我已经在 setenv.sh 文件中传递了 jvm 参数:

export JAVA_OPTS="-Dcom.sun.management.jmxremote=true \ 
            -Dcom.sun.management.jmxremote.port=9999\ 
             -Dcom.sun.management.jmxremote.authenticate=false\ 
             -Dcom.sun.management.jmxremote.ssl=false \ 
            -Djava.rmi.server.hostname=192.168.1.2" 

并将此文件放入$/usr/share/tomcat7/bin/目录。
并且出于身份验证目的,jmxremote.password 和 jmxremote.access 文件都放入“/var/lib/tomcat7/conf/”目录。

File permissions :

**$sudo chown tomcat7:tomcat7 /var/lib/tomcat7/conf/jmxremote.*** is ensuring that both file owned by tomcat7

**$ sudo chmod 0600 /var/lib/tomcat7/conf/jmxremote.*** //  access right for tomcat7

$ 须藤猫 jmxremote.password

admin alonegk

$ 须藤猫 jmxremote.access

admin readwrite

同样的事情 运行 我在开发服务器和我的本地主机上做的很好。

感谢期待

请尝试以下操作:

export JAVA_OPTS="-Dcom.sun.management.jmxremote \ 
            -Dcom.sun.management.jmxremote.port=9999\ 
             -Dcom.sun.management.jmxremote.authenticate=false\ 
             -Dcom.sun.management.jmxremote.ssl=false \ 
            -Djava.rmi.server.hostname=192.168.1.2" 

由于身份验证设置为false,用户名和密码在这里没有任何意义。

如果您想使用用户名和密码,应附加以下两个字符串:

-Dcom.sun.management.jmxremote.password.file=<PATH>/jmxremote.password
-Dcom.sun.management.jmxremote.access.file=<PATH>/jmxremote.access