#!/bin/bash
# file: $CATALINA_HOME/bin/debug.sh
export JPDA_DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=5469,server=y,suspend=n"
export JAVA_OPTS="$JAVA_OPTS $JPDA_DEBUG"
./startup.sh
把文件保存在tomcat的bin目录下debug.sh
chmod +x debug.sh
sh debug.sh
出现监听程序就可以调试了,前提是防火墙没有屏蔽端口。
[admin@localhost bin]$ netstat -ntlp | grep 5469
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:5469 0.0.0.0:* LISTEN 9483/java