5

I can't get the debugger to work. Steps to reproduce:

1) sbt lagom:runAll

enter image description here

2) sbt -jvm-debug 5005

enter image description here

3) Set remote config in Intellij + start debugging

enter image description here

enter image description here

4) Set breakpoints

enter image description here

5) Make request

enter image description here

The debugger doesn't stop at the breakpoints.
What is the problem here?

html_programmer
  • 18,126
  • 18
  • 85
  • 158

2 Answers2

5

You need to use the -jvm-debug flag on the sbt runAll command, like this:

sbt -jvm-debug 5005 runAll

The following steps in your list are correct.

When you run sbt runAll and sbt -jvm-debug 5005 as separate commands, you are creating two separate sbt sessions: one that runs your services, and the other is doing nothing but waiting for input at the prompt. When you connect your debugger, it is connecting to the second, idle session, instead of the one that is running your services.

Tim Moore
  • 8,958
  • 2
  • 23
  • 34
  • 1
    And how to do the same with maven? What to add to this command to make maven open debug port `./mvnw lagom:runAll`? – Ruslan Stelmachenko Aug 22 '19 at 18:46
  • @RuslanStelmachenko maybe you should open another question, but Maven ships with a script called `mvnDebug` that launches it with debug options. – Tim Moore Aug 24 '19 at 05:01
0

@Ruslan Stelmachenko as @Tim Moore said - just execute:

mvnDebug lagom:runAll

and maven will tell you on what port is it listening to connect with remote debug connection and will nicely wait for this connection:

enter image description here

kasopey
  • 355
  • 4
  • 17
  • I tried it, but not sure what to do after it. I see message on console as 'Listening for transport dt_socket at address: 8000'. What to do now to hit the service in browser? – Mandroid Jan 10 '20 at 15:38
  • 1
    Got it. Needed to configure remote. – Mandroid Jan 10 '20 at 15:45