But first we need to know how to enable a JVM to be debugged remotely. Any application server like JBoss, Tomcat, Weblogic, etc. or a simple JVM instance can be debugged remotely. Pass the following arguments to a JVM to enable remote debugging.
-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
If both the debugger and target JVM is 5.0 and above then the preferred way is given below, although the above will also work.
-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n
More information of Java debugger is available here
To enable Jboss or Tomcat for remote debugging, you need to set JAVA_OPTS environment variable with the above arguments. Start the server, the Java Debugger is ready to listen on the defined port.
Follow the below steps to configure Eclipse for debugging -
The first task to debug a problem is to set breakpoints in the code where you think the problem persists. Eclipse allows conditional breakpoints which gets triggered when the defined condition evaluates to true. At runtime value of a variable can be changed to debug the code. Another useful functionality is to add a Java exception breakpoint, which gets triggered when the said exception is thrown.
No comments:
Post a Comment