tomcat如何以debug模式启动

1, 编辑tomcat\bin\catalina.bat,在
rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=�%"
前添加以下代码以绑定一个端口8787:
if ""%1"" == ""stop"" goto skip_config
SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787

:skip_config

address指的是将启动8787端口进行绑定.

2, 在eclipse中进行配置:

右键工程->Debug as->Debug Configurations


在弹出的设置框中找到 Remote Java Application 下面会有自己的工程,将port设置为8787,然后apply->close:


OK,设置完毕。要进行debug首先要运行start.bat启动tomcat,但是这样只是一般的启动,还未进入debug模式。要想debug,就要在工程上右键->Debug as->Debug Configurations->Remote Java Application->passing(自己的工程名)->debug。之后就可以打断点debug了

猜你喜欢

转载自lovelease.iteye.com/blog/1750570