服务器tomcat中Myeclipse使用远程Debug

远程debug流程,有些时候,远程得单体架构项目在本地运行的好好的,但是到了线上就是各种问题:于是远程debug还是有用的

保持线上的服务器中的项目和本地代码,数据库一致。

进入服务器:找到tomcat启动脚本

startup.sh

vim startup.sh

服务器tomcat中Myeclipse使用远程Debug

放开:

declare -x CATALINA_OPTS="-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000"

然后:wq

启动服务器:

2.找到myeclipse中的项目

项目右键,debugAs-->debugconfigurations...--->remoter

服务器tomcat中Myeclipse使用远程Debug

右键 new 

服务器tomcat中Myeclipse使用远程Debug

配置对应项目,配置服务器服务器地址,配置服务器端口。然后启动了debug,进入debug面板,正常的话

 

然后在debug控制面板,看到一个远程的debug,一个本地的debug,这样的话,可以让你启动本地的tomcat。 若在代码中打上断点,这样会出现有远程访问到你这里的这段代码,就会出现远程debug了。