IntelliJ remote debugger connects, but breakpoints are not working
Solution 1
This is what I use for remote debugging:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=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.
Solution 2
Ah finally, After big struggle ! I found it for me !
I needed to disable forking in build.sbt
fork in Test := false,
It makes total sense, as it's only the first JVM who would get to be attach to the IDE.
I hope it help someone !
Joaquim d'Souza
Updated on June 17, 2022Comments
-
Joaquim d'Souza almost 2 years
I am trying out the Scala web framework Scalatra. According to the docs here, the steps to enable IntelliJ debugging are:
- Add the usual JDK options for remote debugging:
"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
- Create a "Remote" run configuration in Intellij
- Start up
sbt
, runjetty: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.
- Add the usual JDK options for remote debugging:
-
Joaquim d'Souza almost 7 yearsAh OK, I saw somewhere else that jetty runs on the same JVM as SBT but will give this a go
-
brunovianarezende almost 7 yearsI had to use xsbt-web-plugin 3.0 for this to work, this is the code in plugin.sbt:
addSbtPlugin("com.earldouglas" %% "xsbt-web-plugin" % "3.0.0")
-
Joaquim d'Souza almost 7 yearsThis made a lot of sense, but did not work. I have:
addSbtPlugin("com.earldouglas" %% "xsbt-web-plugin" % "3.0.1")
And then> set debugPort in Jetty := 5005
> jetty:debug
Which prints out:> Listening for transport dt_socket at address: 5005
And I run Debug from IntelliJ to get:Connected to the target VM, address: 'localhost:5005', transport: 'socket'
But still no luck with the breakpoints :-( -
Joaquim d'Souza almost 7 yearsOK so my IntelliJ is out of date by ~1 year so let me update this!
-
brunovianarezende almost 7 yearsalso, this is what I use in intellij for remote debugging:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
. What you show above is used in theFor JDK 1.4.x
-
Joaquim d'Souza almost 7 yearsThat worked! Can you add that as an answer so I can accept it? I didn't need to use
xsbt-web-plugin
orset debugPort in Jetty := 5005
-
brunovianarezende almost 7 yearsbut, did you need to use jetty:debug?