开启tomcat8的远程监调试
tomcat远程调试的原理是JDWP(Java Debug Wire Protocol)协议
1. 修改startup.sh最后一句命令```shell
exec “$PRGDIR”/“$EXECUTABLE” start “$@”
添加jpda参数,具体用于catalina.sh中,必须是在第一个参数
exec “$PRGDIR”/“$EXECUTABLE” jpda start “$@”
<a name="y7dxk"></a>
### 2. 修改catalina.sh中用于jdwp的地址和端口```shell
# 这里表示启动的第一个参数是jpda则开启
if [ "$1" = "jpda" ] ; then
if [ -z "$JPDA_TRANSPORT" ]; then
JPDA_TRANSPORT="dt_socket"
fi
if [ -z "$JPDA_ADDRESS" ]; then
# 修改这里的端口和位置
JPDA_ADDRESS="0.0.0.0:10080"
fi
if [ -z "$JPDA_SUSPEND" ]; then
JPDA_SUSPEND="n"
fi
if [ -z "$JPDA_OPTS" ]; then
JPDA_OPTS="-agentlib:jdwp=transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND"
fi
CATALINA_OPTS="$JPDA_OPTS $CATALINA_OPTS"
shift
fi
3. 在idea中调试远程tomcat
1、添加remote tomcat,并且设置远程tomcat的IP和端口