Java Tomcat Glassfish Weblogic远程debug(remote debug)

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设置即可,仅需要更改端口号

 

转载于:https://www.cnblogs.com/xiaozhuweiba/p/5663555.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值