Technical Blog

2 Posts tagged with the debugging tag

Remote debugging with Eclipse can be useful in many cases, especially if the server you'd like to debug isn't running through Eclipse, either locally or remotely. The following steps will configure remote debugging for JBoss. You'll need to adjust them a bit for other servers.

 

Changes to Server

  1. Locate the bin folder of the server you are running
  2. Add the following JAVA_OPTS setting to run.bat
    • set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n %JAVA_OPTS%
  3. Relaunch your server

 

In Eclipse

  1. Launch the Debug Configurations window (Run -> Debug Configurations)
  2. In the Debug Configurations window, create a new Remote Java Application
    • Name: Enter name for the new configuration
    • Connection Type: Standard (Socket Attach)
    • Host: Enter IP address server is at
    • Port: Port number specified in JAVA_OPTS above (This example uses 8787)
  3. Attach the source code that's running on the remote server:
    • In the Source tab, click Add...
    • Select Java Project and click OK
    • Add the following projects: 
      • com.elasticpath.connect
      • com.elasticpath.cm
      • com.elasticpath.search
      • com.elasticpath.sf
      (Note that com.elasticpath.core will be added automatically)
    • Click Apply
  4. Click Debug
    • At this point, if you are in the Java Perspective in Eclipse, you won't see anything different
  5. Change perspectives by going to Windows -> Open Perspective -> Others...
  6. Select Debug and click OK

 

Now you're ready to debug JBoss!

 

To debug, simply set breakpoints in parts of the code you're interested in and debugging is exactly the same as if the server was running within Eclipse!

 

For more information, you can refer to the following links:

0 Comments Permalink

Short screencast illustrating how to enable and use the Step Filtering feature of Eclipse:

 

 

Here are the step filters that should be enabled to skip over Spring's dynamic proxy code:

  • $Proxy*
  • java.*
  • javax.*
  • org.apache.*
  • org.springframework.*
  • sun.*
  • java.lang.ClassLoader
1 Comments Permalink