Remote debug JBoss AS 7.1 from Eclipse Indigo

↘锁芯ラ 提交于 2019-12-14 00:25:59

问题


I read some guides on the subject and made the following steps.

http://oreilly.com/pub/a/java/archive/eclipse-jboss-remote-debug.html?page=8 https://community.jboss.org/thread/177687 JBoss debugging in Eclipse

The guides have some distinctions but on the whole they are similar.

The steps I made.

  1. I compiled and deployed my web project and deployed it on JBoss AS 7.1 by clicking Run on Server -> JBoss AS 7.1 in Eclipse.
  2. I stopped JBoss AS in Eclipse.
  3. I uncommented the line

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

in the $JBOSS_HOME/bin/standalone.conf file

  1. I executed $JBOSS_HOME/bin/standalone.sh
  2. I updated the page localhost:8080/MyProject/ in the browser and it worked
  3. I executed Debug -> Debug Configurations in Eclipse, then I created a new configuration with the localhost as the host, 8787 as the port, and MyProject as the project name.
  4. I pressed the Debug button in Eclipse.

When I reach a breakpoint I added, nothing happens.

I expected that Eclipse would stop at the breakpoint as it does in a simple Java application project. What did I do wrong?

Eclipse version: Indigo.

Java.

java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01, mixed mode)

Edit #1.

  1. Window -> Preferences -> Java -> Installed JRE's
  2. Edit JRE being used
  3. Edit 'Default VM Arguments' line

    -XX:+UseParallelGC

It didn't help.


回答1:


Instead of making the changes in "standalone.conf", make the change in "standalone.conf.bat" .

Remove the rem from the line "rem set "JAVA_OPTS=%JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"" .

This has worked for me.




回答2:


You will need to start JBoss with a few extra options to the JVM. You can set these either in standalone.xml, or via the JAVA_OPTS environment variable. The options look basically the same, but for this post I will use JAVA_OPTS. Read this post from the JBoss Community forum if you want to use standalone.xml to configure the JVM parameters.

Add this line to your existing JAVA_OPTS:

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

The port number (8787) above must match your Eclipse setup (see below).

Finally, you will need to tell Eclipse how to connect to the remote process. In Eclipse, click the Debug button’s drop-down arrow and select “Debug Configurations”.

  • In that dialog, navigate to “Remote Java Application” and click the “New” button.
  • Under “Project” select the project that contains the code you want to debug.
  • Under Connection Type make sure “Standard (Socket Attach)” is selected.
  • Under Connection Properties, make sure the host (e.g., localhost) and port (which must match the port spec in the JAVA_OPTS, in this case 8787) are set.
  • Click on the “Source” tab and add any projects containing code you want to debug (if there are other projects in your workspace that contain code other than the main project).
  • In the Common tab, under “Display in favorites menu” select the Debug icon and a handy dandy icon will appear in your Debug toolbar dropdown (the name will be the same as the Project setting from earlier).

If JBoss is already running (with the options set earlier) click Debug to attach. If not, start JBoss, then click Debug to attach.

Now you can set breakpoints, step through your code, etc.

Have fun!



来源:https://stackoverflow.com/questions/17660063/remote-debug-jboss-as-7-1-from-eclipse-indigo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!