eclipse 远程debug

来源:互联网 发布:v2ex java代码 编辑:程序博客网 时间:2024/05/22 04:29

1.debug ant target

<target name="debugTask">
   <java classname="com.emobile.test.util.Test" fork="true">
      <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8099,server=y,suspend=y" />
      <classpath>
         <pathelement location="${build.classes.dir}" />
         <path refid="compile.classpath" />
      </classpath>
   </java>
</target>

2.tomcat debug


S1、设置环境变量CATALINA_OPTS
    在catalina.bat的开始位置,添加以下内容: 
    rem ********************* 设置Tomcat remote debug *************************************
    SET CATALINA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
    rem ***********************************************************************************

S2、启动tomcat
    使用startup.bat启动tomcat,在eclipse中使用tomcat插件启动则无效。

S3、配置eclipse,
    run->open debug dialog->Remote Java Application,进行相应配.
    host是tomat所在的地址
    端口号是上面设置的端口(8787)

S4、执行代码
    代码执行后,即可进入debug状态。在设置断点的地方,系统会停止,等待下一步执行。


3.debug JBOSS

 找到JBOSS_HOME/bin目录下的run.conf文件,找到:

    #JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"

    将其修改为:

    JAVA_OPTS="$JAVA_OPTS -Xdebug     -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"

 4.debug Weblogic

Setting up Debug Configuration for Weblogic Server.

Here will be given instructions on how to setup Weblogic with remote debugging enabled. Accomplish the following steps to enable application debugging:

  1. Locate startWebLogic.cmd ("...\domains\nechodomain\bin\startWebLogic.cmd") and add the following variable DEBUG_OPTS:
    ...
    @REM Set debug options
    set DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n
    echo starting weblogic with the following debug options: %DEBUG_OPTS%
    @REM START WEBLOGIC
    ...
  2. Next, insert the new variable to the WebLogic startup command, after "%JAVA_HOME%\bin\java" and preferably before the other options. Your startup script should look like:
    ...
    %JAVA_HOME%\bin\java %DEBUG_OPTS% %JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS% -Dweblogic.Name=%SERVER_NAME% -
    Djava.security.policy=%WL_HOME%\server\lib\weblogic.policy %PROXY_SETTINGS% %SERVER_CLASS%
    ...

This should enable remote debugging functionality for Weblogic. To check that remote debugging port is open, after starting Weblogic server from the command line run: "netstat /a" and make sure that the debugging port (1044) presents in the list of the opened ports.



原创粉丝点击