如何启动Tomcat的调试功能
Step 1: 修改catalina.bat文件
拷贝-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9527,suspend=n
到catalina.bat文件中的232行
rem Execute Java with the applicable properties
if not "%JPDA%" == "" goto doJpda
if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity
%_EXECJAVA% %JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9527,suspend=n %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
Step 2: 保存,重启Tomcat
Step 3: 在eclipse中配置Debug Configurations
其中Connection Properties中配置的Port为
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9527,suspend=n中指定的端口。