Remote Debugging a Liberty Server - quality-manager/onboarding GitHub Wiki

Liberty can be configured to allow a program such as Eclipse to connect remotely using the Java Platform Debugger Architecture, JPDA in order to see debugging information.

Configuring Liberty

To configure Liberty to allow remote debugging, edit the server.startup.bat script located under <CLM_installation_directory>/server directory

  1. Stop the Liberty server
  2. Start server in debug mode using server.startup -debug
    1. Optionally, you can custom configure the debug options by adding the following entry line before the rest of set JAVA_OPTS=%JAVA_OPTS% -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 so that it displays something like this Note: in this example 8000 will be the port used to attach a debugger. You can choose to use another port though.
  3. Restart the Liberty Server

Using Eclipse to debug Liberty

Once you have set some breakpoints for your application we are ready to debug the code while running in the Tomcat server.

  1. From Jazz or Eclipse select Run->Debug Configurations... from the menu.
  2. On the left hand side of the Debug Configurations dialog right click on Remote Java Application and select New. Give the new configuration a name.
  3. In the Connect section (Connect tab) click the Browse... button to select the project you wish to debug.
  4. Under connection properties make sure to specify the Host and port of where JPDA is running. In this example the port is 8000 as indicated in the Configuring Liberty section above.
  5. Click Debug to launch the debugger

At this point you are ready to execute the code running in Liberty. The debugger will halt execution of the application upon reaching a break point.