Setting up Remote Debugging in Eclipse

Developers sometimes need to debug the related application remotely. The reason may be difficulty of catching the case on local environment, lack of data or urgency. Because of risks (and do not do it if possible), debugging production is not preferred, but test environments are suitable for debugging. Just be careful not blocking the requests. I will tell you how to avoid blocking test requests when debugging.

To define remote debugging in Eclipse you will need 3 important information:

  • End point address
  • Port number
  • Java projects you need to debug

Below is a screenshot example of Remote Java Application

As you can see, you need to choose the main Java project. It is mostly the one that has starting point when you debug starts. For example, if you want to debug a web or rest service, you probably choose the project that include the related service. If you want to debug more projects especially in build path of the main project ones, you can add them in Source tab.

Let’s jump to second step: placing breakpoints. Adding a new breakpoint is easy as much as a double click. But the trick comes here. If you leave the breakpoint without any condition, any request comes to server could be blocked and you may break up running program or tests by throwing TimeOutException to clients. To solve this problem we make our breakpoint conditional. One of the best practices when entering the condition is to use specific values such as customer number. By this way, only your requests will be broken to debug:

Hope, it was a useful article especially for the young software developers.

Software Architect