IntelliJ remote debugger connects, but breakpoints are not working

Joaquim d'Souza picture Joaquim d'Souza · May 29, 2017 · Viewed 12.6k times · Source

I am trying out the Scala web framework Scalatra. According to the docs here, the steps to enable IntelliJ debugging are:

  1. Add the usual JDK options for remote debugging: "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
  2. Create a "Remote" run configuration in Intellij
  3. Start up sbt, run jetty:start, and then start the remote debugger

When I do this, SBT prints out:

Listening for transport dt_socket at address: 5005

And IntelliJ prints:

Connected to the target VM, address: 'localhost:5005', transport: 'socket'

However, breakpoints do not seem to be working. When I hit the following endpoint, with a breakpoint at the *:

class AppServlet extends AppStack {
  get("/break-test") {
*   val response = "DONE"
    response
  }
}

The code does not stop at that line, but continues so I get the response DONE back.

I am using Java 1.8.0_111, Scala 2.12, and SBT 0.13.15.

Answer

brunovianarezende picture brunovianarezende · May 31, 2017

This is what I use for remote debugging:

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,addres‌​s=5005.

The value you use above in your answer, -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005, is used in the For JDK 1.4.x field.