简体   繁体   English

在生产中连接jmx时出错

[英]Error while connecting jmx on Production

For some reason i'm not able to connect java pid on production server using VisualVM. 出于某种原因,我无法使用VisualVM在生产服务器上连接java pid。

I have pass the jvm parameter in setenv.sh file: 我在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" 

and put this file into $ /usr/share/tomcat7/bin/ directory. 并将此文件放入$ / usr / share / tomcat7 / bin /目录。
and also for authentication purpose both jmxremote.password and jmxremote.access file put into "/var/lib/tomcat7/conf/" directory. 并且为了验证目的,将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

$ sudo cat jmxremote.password $ sudo cat jmxremote.password

admin alonegk

$ sudo cat jmxremote.access $ sudo cat jmxremote.access

admin readwrite

The Same thing running fine while i did it on dev server as well as my localhost. 同样的事情在我在dev服务器以及我的localhost上运行时运行良好。

Thanks in anticipation. 谢谢你的期待。

Please try with the following : 请尝试以下内容:

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" 

Since the authentication is set to false, username and password does not have any significance here. 由于身份验证设置为false,因此用户名和密码在此处没有任何意义。

In case you want to use username and password, the following two strings should be appended : 如果您想使用用户名和密码,则应附加以下两个字符串:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM