1. Configuring Tomcat in Linux is added as follows in catalina.sh
Catalina_opts= "-xdebug-xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n" (Do not change lines, to be on the same line)
2. Modify Catalina,bat file in window, add:
Set "Catalina_opts=-xdebug-xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
As shown in figure:
Parameter description:
-xdebug: Enable debug mode
-xrunjdwp<sub-options>: Loading the JVM's JPDA reference implementation Library
Transport=dt_socket:socket connection, optional Dt_shmem connect to the debug server through shared memory
address=8000: The port that the debug server listens on
Server=y: Is the server side, N is the client
Suspend=n: The boot process does not load pause, Y is paused during startup, easy to debug the startup process
3, start Tomcat to see if Tomcat started successfully,
If the startup succeeds, the following output is available in the Tomcat log file (Catalina.out):
Listening for transport dt_socket at address:8000
4. Debug with Eclipse:
When you click Debug, you can debug.
The rest is the same as normal debugging. Breakpoints are added directly to the source code.
5. Possible connectivity issues:
Failed to connect to remote VM. Connection refused.
Connection Refused:connect.
The situation that appears as shown in the picture may be that a connection has been established.
Workaround: Go to the debug perspective,
Find the Click to disconnect the link, you can solve the problem.