tomcat jpda 远程调试
像一些主流的IDE都可以在本地用调试状态运行tomcat,但如何在本地调试其他电脑上的tomcat呢?tomcat可以通过jpda进行远程调试。
我在网上看到一些例子,都是讲怎样改startup.bat(linux下是startup.sh)或者是改catalia.bat( linux下是catalia.sh)。我觉得这样子太有侵入性了,怎样才能不改文件进行远程调试。我用的是tomcat 6.0.18。windows下可以通过命令"catalia.bat jpda start",用调试状态启动tomcat,linux则是"./catalia.sh jpda start"。我仔细看catalia.bat 和 catalia.sh的区别,bat 里面的默认jpda参数是
JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start"
command is executed. The default is "dt_shmem".
JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start"
command is executed. The default is "jdbconn".
JPDA_SUSPEND (Optional) Java runtime options used when the "jpda start"
command is executed. Specifies whether JVM should suspend
execution immediately after startup. Default is "n".
sh 里面默认jpda参数是
JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start"
command is executed. The default is "dt_socket".
JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start"
command is executed. The default is 8000.
JPDA_SUSPEND (Optional) Java runtime options used when the "jpda start"
command is executed. Specifies whether JVM should suspend
execution immediately after startup. Default is "n".
我测试一下,通过netbeans的调试连接器,远程调试linux下运行的tomcat。