One of the important aspects of J2EE development is debugging. To debug an application built on a J2EE framework is one of the difficult thing to do. So today's tip is about to debug a j2ee application using Eclipse IDE and deployed in Jboss using remote invocation, this is known as Remote Debugging.
To let remote debugging work you need to change the shell/batch file that starts up the application/server that you want to remote debug - it's a one line change. Go to the line where the JVM is initiatiated (i.e. where the "java" command is invoked) and add the following:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=5555
Where '5555' is the port you want to attach the remote debugger to. Change it to whatever port you want.
In your remote debugger (in this case eclipse) click "Debug.." then select "remote java application" as per this:
then right click and say "new":
in the 'port' field make sure it matches the port that you gave in the batch file. also make sure that when you compile the code that gets deployed to the server that the compiler is set up to include debug symbols (the application build script does this already).
Start the Jboss server up. Note that it will pause and give you a message saying that it is waiting for a remote debugger to attach. when you see this, go back to eclipse ide and click the 'debug' button as shown above.
From here on in breakpoints/etc behave as if you are running the code directly inside eclipse ide.
0 Responses to J2EE Server Side Debugging in Eclispe
Something to say?