1. In Linux, configure Tomcat to add the following in catalina.sh
Catalina_opts= "-xdebug-xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n" (do not wrap to the same line)
2. Modify the Catalina,bat file in window to add:
Set "Catalina_opts=-xdebug-xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
Parameter description:
-xdebug: Enable debug mode
-xrunjdwp<sub-options>: Loading JVM's JPDA reference implementation Library
Transport=dt_socket:socket connection, optional Dt_shmem connect to the debug server via shared memory
address=8000: The port that the debug server listens on
Server=y: Whether it is server side, N is client
Suspend=n: Whether the boot process is loading paused, Y is paused at startup, and the startup process is easy to debug
3. Start Tomcat to see if Tomcat started successfully,
If the boot succeeds, the Tomcat log file (Catalina.out) will have the following input:
Listening for transport Dt_socket at address:8000
4. Use Eclipse Debugging:
Click Debug, and you can debug it.
The rest is just like normal debugging. Breakpoints are added directly to the source code.
5. Connection problems that may occur:
Failed to connect to remote VM. Connection refused.
Connection Refused:connect.
The situation may be that a connection has been established.
Workaround: Go to debug Perspective,
Find the click break link to solve the problem.
This article transferred from: http://blog.csdn.net/afgasdg/article/details/9236877
Eclipse Remote Debugging Tomcat method