Environment:
Server side: Linux + jdk1.7.0_75 + Tomcat 7
Local: Win + jdk1.7.0_55
First, modify the/etc/hosts file
Hostname-i if 127.0.0.1 is displayed, modify/etc/hosts to replace 127.0.0.1 with the real IP of the Linux server
Ii. Modification of catalina.sh file
Vim/usr/local/tomcat7**/bin/catalina.sh #进入tomcat的bin目录下
In # OS specific support. $var _must_ is set to either True or false. Add
#JAVA_OPTS ="-dcom.sun.management.jmxremote.port=9008-dcom.sun.management.jmxremote.ssl=false- Dcom.sun.management.jmxremote.authenticate=false"
Iii. modification of jmxremote.access and jmxremote.password.template
Cd/usr/java/jdk1.7.0_75/jre/lib/management
Vim jmxremote.access
Monitotrole read-only permission to add a user xxxx Controlrole read and Write permissions, add user admin
#monitorRole readonlylisssss readonly#controlrole readwrite admin readwrite Create Javax.management.monitor. *,javax.management.timer.* Unregister
MV Jmxremote.password.template Jmxremote.password #重命名
chmod +w Jmxremote.password #增加写权限
Vim Jmxremote.password set a password for read-only and read-write users
# monitorrole 1234xx # Controlrole R&1234xx
Iv. Open the local jconsole and connect the JVM in remote Linux
1. Open Jconsole
CMD----jconsole or double-click the Jconsole.exe under C:\Program files\java\jdk1.7.0_55\bin
2. Connecting the JVM in remote Linux
Select Remote process: IP of remote server: Port number user name, password enter the username or password in jmxremote.password---Click Connect
Jconsole monitoring success such as:
Issue: After monitoring, turn off Tomcat, error: Tip 9008 Port number is occupied, cause when Tomcat is turned off, the port number of the Jmxremote in Catalish is also executed
[Email protected] bin]#./shutdown.SH/usr/local/tomcat7-java_shop/bin/catalina.SH: Line101:-agentpath:/opt/jprofiler7/bin/linux-x64/libjprofilerti.so=port=8080: No Suchfileor directoryusing catalina_base:/usr/local/tomcat7**Using catalina_home:/usr/local/tomcat7**Using Catalina_tmpdir:/usr/local/tomcat7**/tempusing jre_home:/usr/java/jdk1.7. 0_75using CLASSPATH:/usr/local/tomcat7-java_shop/bin/bootstrap.jar:/usr/local/tomcat7**/bin/tomcat-juli.jarError:Exception Thrown by the Agent:java.rmi.server.ExportException:Port alreadyinchUse9008; nested exception is:java.net.BindException:Address alreadyinchUse
Resolution: in the catalish.sh file, determine whether the start command, if it is start, set the variable, otherwise, do not set
java_opts="$JAVA _opts-xms256m-xmx1024m-xx:permsize=128m-xx:maxpermsize=256m"if[" $"="Start"]; Then Echo "Set Console"; Java_opts="-dcom.sun.management.jmxremote.port=9008-dcom.sun.management.jmxremote.ssl=false- Dcom.sun.management.jmxremote.authenticate=false";Else Echo "No startup";fi;
Statement, this essay synthesizes the great God of the article, do not repeat each, here Express thanks!
Local win under Jconsole Monitor JVM under Remote Linux