* About JPDA (http://docs.oracle.com/javase/7/docs/technotes/guides/jpda/architecture.html)html
JPDA: (Java Platform Debugger Architecture), the following diagram illustrates the architecture,java
* How to setup Tomcat for remote debuggingtomcat
It's quite simple to set up Tomcat for remote debugging. Open "bin/startup.bat", and you would find the following line at the end, oracle
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
Just add "jpda" in frond of "start", that'seclipse
call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
This will use the default "JPDA_TRANSPORT" and "JPDA_ADRESS" settings in "bin/catalina.bat",socket
** set JPDA_TRANSPORT = dt_socketide
** set JPDA_ADDRESS=8000工具
After that, if you start tomcat, you would see the following line from the command console, ui
Listening for transport dt_socket at address: 8000
Then you can set up your IDE (eclipse) to attach to the tomcat, spa
除了遠程debug以外,還有一種在開發階段很方便的方式就是在eclipse裏面直接指定tomcat的運行目錄,而後在eclipse裏面啓動tomcat,這樣就能夠直接進行debug了。
第一步: 設置eclipse
window -> preference -> Tomcat, 而後入下圖所示設置tomcat的目錄 -
第二步:進行調試
以下圖所示,能夠在工具欄上直接雙擊tomcat的圖標進行啓動,而後就能夠debug了。