scala + play framework 2.5 - debugging don't working - scala

I have problem with debugger in play framework 2.5 and scala. I use Intelij IDEA 2016.1 IDE, and when i try debug my applicaton, it never stops on break points. I try 2 options:
Run application directly from Intelij IDEA as Play2App i debug mode.
Run application from activator by activator -jvm-debug 9999 command, and connect from IDE as remote debug. Connection is succeed.
In both approach, application don't stop on break points.
If i debug standalone apliaction (with main function), or unit test, all work correctly.
Do you have any idea what can be wrong?

I use Eclipse and had the same issue with play 2.5.4.
Issue fixed after I removed "fork in run := true" from build.sbt
Hope it helps.

Related

playframework 2.5.0 Template fail to compile (fresh one)

I would like to get started with play running play 2.5...
but even installing the template with activator "play-java" has an error.
Using unsupported version of Play: 2.5.0
I have downloaded the full activator package and the minimal.
Both fail on 2 machines(JDK 73).
NO clue how to catch up on this, perhaps some could help me out. I would appreciate it very much.
Bets regards
Using 'activator ui', causes the activator to cycle. The error message is "Getting 'Using unsupported version of Play: 2.5.0'". The issue tracking the problem is https://github.com/typesafehub/activator/issues/1102.
Using 'activator' without the ui argument is a work-around.
Change directories to the play-java directory and running ./activator without the ui argument. This brings up the sbt command line. Sbt commands help, about, tasks, update, compile, test, and run work. A web browser pointed at localhost:9000 will contain a text field with "You're using Play 2.5.0" as content.
The "run" command starts a Netty server. Application interaction is possible using localhost:9000 in a web browser.
As a workaround you can create a project without the UI by using something like
activator new my-app play-scala
Play framework requires java 8 since 2.4 version
https://www.playframework.com/documentation/2.4.x/Migration24#Java-8-support

Breakpoints dont work Remote debugging Play/Activator

I just started with the Play Framework but to learn these kind of things it is amazingly convenient to be able to use breakpoints.
Now I figured quickly that when I run 'activator -jvm-debug 9888' I can connect my Intellij CE 14 to its debugger. That seems to work, console gets nicely printed on the webui 'standard out' but not in my Intellij even when it says it connected.:
'Connected to the target VM, address: 'localhost:9888', transport: 'socket''
But that is truly about it, no console messages are show or breakpoints get hit inside intellij
Anyone had the same problem before and knows how to solve it? (Googling didn't find me the answer!)
Greets
In your build.sbt try to add this line (with a capital T!):
fork in Test := false
For info see http://www.scala-sbt.org/0.13/docs/Forking.html

Attaching a Remote Debug session to Spark from Eclipse Scala IDE

I've been wracking my brain over this for the last two days trying to get it to work. I have a local Spark installation on my Mac that I'm trying to attach a debugger to. I set:
SPARK_JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
Then I submit my job to spark-submit and launch my debug configuration in eclipse which is configured as a Socket Attach Remote Debugging session. The debugger attaches, my job resumes and executes, but none of my breakpoints are ever hit, no matter what I do.
The only way I can get it to hit a breakpoint is by attaching to a spark-shell, creating a Java Exception breakpoint and issuing
throw new java.lang.Exception()
The debugger will not stop at normal breakpoints for me.
I created a standalone Hellow World scala app and was able to attach to it and have it stop at a regular breakpoint without any issues.
Environment: Mac OS, latest Eclipse, latest Scala IDE, Spark 1.3.1, Scala 2.10.5
Thanks in advance.
I had a similar issue and there were 2 things that fixed my problem -
1. The .jar file and source not a little out of sync for me , so had to recompile and redeploy.
2. Next On the JAVAOPTS I had a suspend=n.
After correcting these two it worked for me .

Doesn't work debug for play project in IDEA 14 Ultimate

I do following steps:
Import to IDEA Play project generated with Activator UI from Play Scala Seed template.
Create Run/Debug configuragion using standart "Play 2 App" template.
Add break point in my project.
Run debug and open page in a browser.
I can see in IDE console "play - Application started", and debugger tells me
"Connected to the target VM, address: '127.0.0.1:58354', transport: 'socket'"
But program execution doesn't stop at my break points. In a browser I can see
what a code for that I've made a break point is executed.
What's wrong with IDEA?
I use play version 2.3.9, and I start the play app from an IDEA ide not from a play console.
seems duplicate with :
How to run Play Framework 2.x in debug mode in IntelliJ IDEA?
Your first step seems wrong. Just open (and don't import) your project is enough from IntelliJ.

Missing 'debug' command from Play 2.0 installed from Typesafe

I installed play 2.0 from the typesafe stack.
However, when i try to run sbt debug run it gives me the error:
[error] Not a valid key: debug (similar: idea)
Any suggestions on how to run a debug server?
In order to debug with the sbt command instead of the play command, you have the option to set the env. variable SBT_OPTS with the classical
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999
Source : https://groups.google.com/forum/?hl=fr&fromgroups#!topic/play-framework/-RVlEh8S2F4
I spent quite some time on this tonight. Hope my experience helps.
And as many of you I am encountering same issue that debug is not recognized under sbt. The easiest way of course is to follow the documentation. install the Play standalone and run the play debug run command, and then debug remote java application using the 9999 port.
but #Julienlafont 's solution did workout as well (I had the confusion at first as well). The key is to understand the whole process. Play web server is still served through port 9000. but port 9999 is opened as debug port to let IDE connect to , this is important.
I guess the reason why debug is not recognized is because it is not a sub command at all. it is indeed a couple of JVM arguments as #Julienlafont point out. so the what play command did is simply wrap the JVM argument for you. note once you enter the play console, the debug extension wont be recognized, because its essence is a couple of JVM arguments.
so go ahead set that JVM argument, once you see the hint , you are done with opening the debug port. run your server and finish the remaining part.