eclipse remote debug code

Reference: http://blog.csdn.net/sunyujia/article/details/2614614

https://www.cnblogs.com/Vince-blogs/p/7497011.html

When it is difficult to locate the cause of a bug based on the log in the project, we need to remotely debug the test or production code. Now let's talk about how to make eclipse debug and track remote programs locally.

Add this line to the top of start.sh of tomcat's bin:

declare -x CATALINA_OPTS="-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000"
On the window, modify Tomcat/bin/startup.bat file and add the following code at the top
SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000

The port number can be modified to other ones.
Check if the port is occupied: netstat -anp | grep 8080
It is recommended that an unused port be required.
Stop and restart tomcat. You can use the command netstat -anp | grep 8080 to check whether the setting takes effect.
If you see -server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8080, the settings have taken effect
Can be used locally: start/min telnet 10.255.8.4 8080
See if it can be pinged. If it is, a doc command window will pop up; if it is different, the window will flash.

Configure remote debug in eclipse

  Click the debug icon in the eclipse navigation bar - click Debug Configuration - right click Remote Java Application - New - select the project, Standard (Socket Attach), enter the remote host IP, port,

  Finally click the Debug button  



 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326186799&siteId=291194637