First, modify the tomcat configuration, remote debugging starts
Linux(bin\catalina.sh)
# The localhost instead 0.0.0.0 IF [the -z "$ JPDA_ADDRESS"]; the then JPDA_ADDRESS = "0.0.0.0:8000" # start debugging bin / catalina.sh jpda start
Windows(bin\catalina.bat)
Linux can not afford to follow the effect seems to modify the way.
# Set the variable the SET JPDA_ADDRESS = 8000 the SET JPDA_TRANSPORT = dt_socket # start debugging bin / catalina.bat jpda start
Two, IDEA set
Adding remote debugging configuration, choose Remote, not under Tomcat Remote server.
Configuring remote address, port, and the project to debug
Start Debugging (IDEA does not publish local project to Tomcat, you need to manually release the need to ensure consistency with the remote Tomcat native code in the debugger)
Above message appears on behalf of the connection is successful, you can break point debugging.
Third, the use of remote monitoring jvisualvm JVM
Modify bin \ catalina file, add the JAVA_OPTS in the start position
JAVA_OPTS="-Djava.rmi.server.hostname=192.168.8.229 -Dcom.sun.management.jmxremote.port=1100 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false" # 开启 JMX 远程服务权限 # -Dcom.sun.management.jmxremote.port:配置远程 connection 的端口号 # -Dcom.sun.management.jmxremote.ssl:指定 JMX 是否启用 ssl # -Dcom.sun.management.jmxremote.authenticate:指定 JMX 是否启用密码 # -Djava.rmi.server.hostname:配置 Server IP(不要使用 127.0.0.1)
Windows 下打开 JDK 目录下的 bin/jvisualvm.exe 程序
添加 JMX 连接,填写地址和端口即可
查看堆栈