Debugging with JBuilder 6 Enterprise
tobias Jul 15, 2002 10:26 AMdrcharris wrote:
Q: how do I debug JBoss under JBuilder 6 Enterprise?
A: you have two options - in-process debugging or remote debugging. Inprocess debugging involves creating a JBuilder project containing all the jars in the JBoss distribution as required libraries and recreating the run.bat file in your Run configuration. It's ugly.
Remote debugging is a much better bet if you have the Enterprise edition. Here's how to do it:
1. Set up a batch file to launch jboss in a JVM with remote debugging enabled. If your file is called launch.bat it would look something like this
(blank lines indicate line breaks - the forums may break lines artificially)
============================
rem Run "launch debug" to enable remote debugging on port 5000
setlocal
set JBOSS_HOME=c:\dev\tools\jboss\jboss
cd %JBOSS_HOME%\bin
set RUN_ARGS=
@if "%1%" == "debug" goto debug
goto nodebug
:debug
set RUN_ARGS=-classic -Xdebug -Xnoagent -java.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=5000,suspend=y
:nodebug
java %RUN_ARGS% -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.crimson.jaxp.DocumentBuilderFactoryImpl -Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserFactoryImpl -classpath "%JBOSS_HOME%/bin/run.jar;%JBOSS_HOME%/lib/crimson.jar" org.jboss.Main default
===========================
where 'default' is the configuration name to use, and JBOSS_HOME is wherever you installed JBoss.
This allows you to run the batch file in two ways. The first runs JBoss normally by typing 'launch'. The second runs it with remote debugging by typing 'launch debug'. The JVM will start and then waiting for a debugger to attach before running the JBoss startup class.
2. Set up JBuilder to debug the JBoss server remotely.
In any JBuilder project, select Run->Configurations. Click New... and make the configuration name "JBoss Remote". Then select the Debug tab, click "Enable Remote Debugging" and then select "Attach". Press OK twice to get back to JBuilder.
Run 'launch debug' from a command window (see step 1).
On your toolbar click the down arrow next to the debug button, and select "Jboss Remote". The debug window will appear, then you should press the green arrow to start running the server.
Any debug breakpoints you then click in your code will get trapped if those classes are called inside JBoss.