Eclipse Debugging

Starting Baratine with Remote Debugging

We need to pass xdebug JVM arguments to Baratine. The following:

java -Xdebug ... -jar lib/baratine.jar

wouldn’t work because starting Baratine is a two-step process where the watchdog process is started first. The watchdog is responsible for monitoring the main Baratine process and restarting it if it ever becomes unresponsive. To correctly pass arguments to Baratine, we need to create a configuration file, say /tmp/baratine/baratine.cf:

cluster {
  server port="8085" {
    jvm-arg "-Xdebug";
    jvm-arg "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000";
  }
}

Then we start Baratine up by passing in the location of that file:

java -jar lib/baratine.jar --conf /tmp/baratine/baratine.cf start

Note

You should continue specifying the configuration file for subsequent command-line commands.

Attaching the Eclipse debugger to Baratine

  1. Right-click your source file in Eclipse and select Debug As –> Debug Configurations.
  2. Right-click Remote Java Application and select New.
  3. Make sure the Host and Port fields are set correctly. Then press the Debug button at the bottom-right corner.

If you have done everything correctly, Eclipse should have attached to the remote Baratine process.

Setting Breakpoints

  1. Set a breakpoint by double-clicking the left-hand margins of your source code.

2. Call your Baratine service to hit that breakpoint. The easiest way is to use curl or your browser:

curl http://localhost:8085/s/pod/myService?m=myMethod