Debugging does not work with the activator of the game environment, scala and eclipse

There are many messages on this, the instructions are simple, but for life I can’t get the debugger to stop at breakpoints.

My environment

  • eclipse 4.4.1
  • scala 2.11
  • scala IDE 4.1.0.nightly
  • play framework 2.3.3
  • playback support in Scala IDE 0.4.6

I run the activator as follows

activator -jvm-debug 9999 run 

I set up a remote debug configuration of a Java application with a standard socket connection. Debugging the configuration starts, attaches to the remote device and starts a bunch of sbt threads.

But this will not stop in the debugger! It seems to me that it's hard, what am I doing wrong?

Edit: I have this problem in a project that I have been working on for some time, and in a completely new, untouched copy of the play-anguale-require-seed project. Here is the build.sbt project for this project:

 import WebKeys._ // TODO Replace with your project's/module name name := """play-angular-require-seed""" // TODO Set your organization here; ThisBuild means it will apply to all sub- modules organization in ThisBuild := "your.organization" // TODO Set your version here version := "2.3.7-SNAPSHOT" // Scala Version, Play supports both 2.10 and 2.11 //scalaVersion := "2.10.4" scalaVersion := "2.11.4" lazy val root = (project in file(".")).enablePlugins(PlayScala) // Dependencies libraryDependencies ++= Seq( filters, cache, // WebJars (ie client-side) dependencies "org.webjars" % "requirejs" % "2.1.14-1", "org.webjars" % "underscorejs" % "1.6.0-3", "org.webjars" % "jquery" % "1.11.1", "org.webjars" % "bootstrap" % "3.1.1-2" exclude("org.webjars", "jquery"), "org.webjars" % "angularjs" % "1.2.18" exclude("org.webjars", "jquery") ) // Scala Compiler Options scalacOptions in ThisBuild ++= Seq( "-target:jvm-1.7", "-encoding", "UTF-8", "-deprecation", // warning and location for usages of deprecated APIs "-feature", // warning and location for usages of features that should be imported explicitly "-unchecked", // additional warnings where generated code depends on assumptions "-Xlint", // recommended additional warnings "-Ywarn-adapted-args", // Warn if an argument list is modified to match the receiver "-Ywarn-value-discard", // Warn when non-Unit expression results are unused "-Ywarn-inaccessible", "-Ywarn-dead-code" ) // // sbt-web configuration // https://github.com/sbt/sbt-web // // Configure the steps of the asset pipeline (used in stage and dist tasks) // rjs = RequireJS, uglifies, shrinks to one file, replaces WebJars with CDN // digest = Adds hash to filename // gzip = Zips all assets, Asset controller serves them automatically when client accepts them pipelineStages := Seq(rjs, digest, gzip) // RequireJS with sbt-rjs (https://github.com/sbt/sbt-rjs#sbt-rjs) // ~~~ RjsKeys.paths += ("jsRoutes" -> ("/jsroutes" -> "empty:")) //RjsKeys.mainModule := "main" // Asset hashing with sbt-digest (https://github.com/sbt/sbt-digest) // ~~~ // md5 | sha1 //DigestKeys.algorithms := "md5" //includeFilter in digest := "..." //excludeFilter in digest := "..." // HTTP compression with sbt-gzip (https://github.com/sbt/sbt-gzip) // ~~~ // includeFilter in GzipKeys.compress := "*.html" || "*.css" || "*.js" // excludeFilter in GzipKeys.compress := "..." // JavaScript linting with sbt-jshint (https://github.com/sbt/sbt-jshint) // ~~~ // JshintKeys.config := ".jshintrc" // All work and no play... emojiLogs fork in run := true 
+7
debugging eclipse scala playframework
source share
3 answers

Chris's comment is the answer! Remove fork in run from build.sbt or set to false. I am not sure the consequences will be lower.

+8
source share

Breakpoints may also be skipped if your scala application does not always match the java one-to-one relationship between the package structure and the directory.

Tired of this game app today. Conditional playback controllers live in the controllers package. As the project grew, it was reorganized into several different subprojects. So the controllers directory remained, but the package was changed to package controllers.foo , which works fine in scala.

As with the OP, despite the direct documentation, nothing worked, the debugger would never hit a breakpoint. As soon as I moved the test controller to the directory corresponding to the package layout, voila, the breakpoint was a success!

For those not using an activator, this will start an sbt debugging session:

java -debug -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9999 -jar ~/bin/sbt-launch.jar " $@ "

then run run in the playback console. Switch to Eclipse and select:

  • Run> Debug Configurations

  • add new Remote Java application

  • select Standard (Socket Attach) or scala Debugger (Socket Attach)

  • host: localhost and port: 9999

  • Click Apply then click "Debug"

If everything goes well, when you visit the controller with a breakpoint set somewhere in the dependency chain, the breakpoint should be removed, which allows you to execute the code as expected.

+1
source share
  • Try to start as usual and copy your first 2 lines of the console log into your editor.
  • Do the same in debug mode.
  • compare:
    • in the first line, in debug mode (not in normal mode) you should have this (with suspend = y ):
      agentlib: JDWP = transport = socket transport, address = 127.0.0.1: xxxxx, suspend = y , server = n
    • in debug mode (not in normal mode), the second line should be present:
      Connected to the target VM, address: "127.0.0.1:xxxxx", transport: "socket"

suspend = y makes your server pending attachment. it may be n

  1. check the configuration of the remote debugger and check the host (localhost) and port (9999) used for listening, and some other parameters (transport, etc.). It must match those of the launcher.
0
source share

All Articles