1. Configuring Tomcat
Linxu system: tomcat/bin/catalina.sh or startup.sh the beginning of the following additions:
Declare-x catalina_opts= "-xdebug-xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9998"
9998 is the port we are debugging remotely, which is used later.
2. Start Tomcat
Looking at the Tomcat console output, we can see that the configuration we just had is in effect and the output is as follows:
3. Configuring Eclipse
Click on the debug icon above Eclipse, select Debug configurations, open the window to find the remote Java application, such as:
You can create a remote debug by double-clicking the remote Java application, as configured:
Click Debug to enter debug mode.
4. Verification
We hit any code in the source code project that needs to be debugged, set breakpoints like normal local debug, and then initiate a request for a project deployed by the server.
As shown, Success!!!
Click on the icon circled above (Disconnect) to disconnect the debug mode.
After disconnecting debug mode, you can turn on debug mode at any time, such as Operation:
< finish >
Eclipse for remote debugging (Tomcat remote debugging)