How do you configure JBoss to debug an application in Eclipse?
问题:
回答1:
You mean remote debug JBoss from Eclipse ?
From Configuring Eclipse for Remote Debugging:
Set the JAVA_OPTS variable as follows:
set JAVA_OPTS= -Xdebug -Xnoagent
-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n %JAVA_OPTS%
or:
JAVA_OPTS="-Xdebug -Xnoagent
-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n $JAVA_OPTS"
In the Debug frame, select the Remote Java Application node.
In the Connection Properties, specify localhost
as the Host and specify the Port as the port that was specified in the run batch script of the JBoss server, 8787
.
回答2:
If you set up a JBoss server using the Eclipse WebTools, you can simply start the server in debug mode (debug button in the servers view). This will allow you to set breakpoints in the application that is running inside the JBoss.
回答3:
VonC mentioned in his answer how to remote debug from Eclipse.
I would like to add that the JAVA_OPTS
settings are already in run.conf.bat
. You just have to uncomment them:
in JBOSS_HOME\bin\run.conf.bat
on Windows:
rem # Sample JPDA settings for remote socket debugging
set "JAVA_OPTS=%JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
The Linux version is similar and is located at JBOSS_HOME/bin/run.conf
回答4:
Here, if you want to directly debug the server then you can use:
1.)Windows ->
2.)Show View -> Server: Right click on server then run In debug mode.
回答5:
You need to define a Remote Java Application in the Eclipse debug configurations:
Open the debug configurations (select project, then open from menu run/debug configurations) Select Remote Java Application in the left tree and press "New" button On the right panel select your web app project and enter 8787 in the port field. Here is a link to a detailed description of this process.
When you start the remote debug configuration Eclipse will attach to the JBoss process. If successful the debug view will show the JBoss threads. There is also a disconnect icon in the toolbar/menu to stop remote debugging.
回答6:
What @VonC says is correct, but you can put the commands to set debug directly into VM
arguments on jBoss
Launch.
To do that, open jBoss
server inside Eclipse
, go to Open launch configuration and put this in VM
arguments textbox
:
vm args