码迷,mamicode.com
首页 > 编程语言 > 详细

Java Tomcat Glassfish Weblogic远程debug(remote debug)

时间:2016-07-12 15:32:30      阅读:331      评论:0      收藏:0      [点我收藏+]

标签:

tomcat

./catalina.sh jpda start

这条命令启动tomcat,它就会监听8000端口,等待调试器的连接。

默认监听8000端口,通过设置环境变量JPDA_ADDRESS指定监听端口

 

例如,监听8001端口:

export  JPDA_ADDRESS=8001

catalina.sh jpda start

Java

For newer JDK :

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=6006

address指定监听端口

对于1.5及以上jdk,推荐使用上述命令。对于1.3及1.4jdk,使用命令如下:

For JDK 1.3 or earlier :

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

For JDK 1.4

-Xdebug-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=6006

 

Fromjava technotes

From 5.0 onwards the -agentlib:jdwp option is used to load and specify options to the JDWP agent. For releases prior to 5.0, the -Xdebug and -Xrunjdwp options are used (the 5.0 implementation also supports the -Xdebug and -Xrunjdwp options but the newer -agentlib:jdwp option is preferable as the JDWP agent in 5.0 uses the JVM TI interface to the VM rather than the older JVMDI interface)

One more thing to note, fromJVM Tool interface documentation:

JVM TI was introduced at JDK 5.0. JVM TI replaces the Java Virtual Machine Profiler Interface (JVMPI) and the Java Virtual Machine Debug Interface (JVMDI) which, as of JDK 6, are no longer provided.

WebLogic

export debugFlag=true

export DEBUG_PORT=7878

set | grep -i debug

./startWebLogic.sh

 

DEBUG_PORT指定端口

Glassfish

asadmin start-domain --debug [domain-name]

默认监听端口9009

 

Enabling Debugging

When you enable debugging, you enable both local and remote debugging. To start the server in debug mode, use the----debugoption as follows:

asadmin start-domain --debug [domain-name]

You can then attach to the server from the Java Debugger (jdb) at its default Java Platform Debugger Architecture (JPDA) port, which is 9009. For example, for UNIX systems:

jdb -attach 9009

For Windows:

jdb -connect com.sun.jdi.SocketAttach:port=9009

For more information about thejdbdebugger, see the following links:

Java Platform Debugger Architecture - The Java Debugger:http://java.sun.com/javase/technologies/core/toolsapis/jpda/

Java Platform Debugger Architecture - Connecting with JDB:http://java.sun.com/javase/technologies/core/toolsapis/jpda/

GlassFish Server debugging is based on the JPDA. For more information, seeJPDA Options.

You can attach to the GlassFish Server using any JPDA compliant debugger, including that ofNetBeans, Java Studio Enterprise, JBuilder, Eclipse, and so on.

You can enable debugging even when the GlassFish Server is started without the----debugoption. This is useful if you start the GlassFish Server from the Windows Start Menu, or if you want to make sure that debugging is always turned on.

To Set the Server to Automatically Start Up in Debug Mode

Use the Administration Console. Select the JVM Settings component under the relevant configuration.

Check the Debug Enabled box.

To specify a different port (from 9009, the default) to use when attaching the JVM software to a debugger, specifyaddress=port-numberin the Debug Options field.

To add JPDA options, add any desired JPDA debugging options in Debug Options. SeeJPDA Options.

See Also

For details, click the Help button in the Administration Console from the JVM Settings page.

IDE设置

intellij

intellij使用默认remote设置即可,仅需要更改端口号

技术分享

 

Java Tomcat Glassfish Weblogic远程debug(remote debug)

标签:

原文地址:http://www.cnblogs.com/xiaozhuweiba/p/5663555.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!