1. Modify the file Catalina. BAT in % cataline_home %/bin.
Find this code
If not "" % 1 "" = "" JPDA "" Goto nojpda
Set JPDA = JPDA
If not "% jpda_transport %" = "" Goto gotjpdatransport
Set jpda_transport = dt_shmem
: Gotjpdatransport
If not "% jpda_address %" = "" Goto gotjpdaaddress
Set jpda_address = jdbconn
: Gotjpdaaddress
If not "% jpda_suspend %" = "" Goto gotjpdasuspend
Set jpda_suspend = N
: Gotjpdasuspend
If not "% jpda_opts %" = "" Goto gotjpdaopts
Set jpda_opts =-xdebug-xrunjdwp: Transport = % jpda_transport %, address = % jpda_address %, Server = Y, suspend = % jpda_suspend %
: Gotjpdaopts
Shift
: Nojpda
Modify the red part,
Set jpda_transport = dt_socket
Set jpda_address = 8787
Note: dt_shmem indicates the local machine; dt_socket indicates remote debugging.
2. Modify the file startup. BAT in % cataline_home %/bin.
Find this code
Call "% executable %" start % cmd_line_args %
Change
Call "% executable %" JPDA start % cmd_line_args %
3. Set the debugging environment in eclipse
In eclipse, select rundebug. In the displayed dialog box, right-click Remote Java application to create a remote debugging item.
Select the project to be debugged in "project", and enter the IP address of the project to be remotely debugged in "host", that is, the IP address of Tomcat, enter the set port number in "Port", for example, the port number set above 8787, and then select "allow termination of remote VM". The connection type does not need to be modified. Click Apply and then debug. Start debugging.