eclipse perform remote debugging code

Prerequisite: one of the following two

1, Linux configure tomcat in catalina.sh add the following
CATALINA_OPTS = "- Xdebug -Xrunjdwp: transport = dt_socket, address = 8000, server = y, suspend = n" ( do not wrap to the same line )

2, Window modified  catalina, bat file, add:

Set  “CATALINA_OPTS=-Xdebug  -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"或

SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8999

Parameter Description:

-Xdebug: Enable debug mode

-Xrunjdwp <sub-options>:  load JVM 's JPDA reference implementation library

= the dt_socket Transport: the Socket connection, optionally dt_shmem  connected to the server through the shared memory debug mode

address = 8000: debug server listens on port

server = y: if the server is, n- client

suspend = n: whether to start the process of loading pause, the y- is when you start to pause, to facilitate debugging boot process

3, modify the registry HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \ Apache Software Foundation \ Procrun 2.0 \ ivms6-Tomcat-6700 \ Parameters \ Java content option option to add the following information:

-Xdebug
-Xnoagent
-Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5889

4, start tomcat , to see tomcat Launch OK,

If you start successfully, Tomcat log file (catalina.out) there will be the following output:

Listening for transport dt_socket at address: 8000

5, using the eclipse debugging:



Click Debug , you can debug the


The rest is the same as the ordinary debugging. Breakpoints added directly in the source code on the line

发布了19 篇原创文章 · 获赞 3 · 访问量 9774

2、Window中修改 catalina,bat文件,添加:

Set  “CATALINA_OPTS=-Xdebug  -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"或

SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8999

参数说明:

-Xdebug                              : 启用调试模式

-Xrunjdwp<sub-options>  : 加载JVMJPDA参考实现库

transport=dt_socket           :Socket连接,可选dt_shmem 通过共享内存的方式连接到调试服务器

address=8000                     :调试服务器监听的端口

server=y                             : 是否是服务器端,n为客户端

suspend=n                         : 启动过程是否加载暂停,y为启动时暂停,方便调试启动过程

3、修改注册表中HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\ivms6-Tomcat-6700\Parameters\Java内容option选项,添加如下信息:

-Xdebug
-Xnoagent
-Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5889

4、启动tomcat,看看tomcat是否启动成功,

如果启动成功,tomcat日志文件(catalina.out)中会有如下输出:

Listening for transport dt_socket at address: 8000

5、使用eclipse调试:



点击debug,就可进行调试了


剩下的就和普通调试一样了。断点直接在源代码中添加就行

Guess you like

Origin blog.csdn.net/pinghuqiuyue9/article/details/50949385