Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Duncan Godwin
    I just see this:

    [info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

    (Server started, use Enter to stop and go back to the console...)

    [info] p.a.i.l.c.CoordinatedShutdownSupport - Starting synchronous coordinated shutdown with ServerStoppedReason reason and 35000 milliseconds timeout
    [info] p.c.s.AkkaHttpServer - Stopping Akka HTTP server...
    [info] p.c.s.AkkaHttpServer - Terminating server binding for /0:0:0:0:0:0:0:0:9000
    [info] p.c.s.AkkaHttpServer - Running provided shutdown stop hooks

    [success] Total time: 3 s, completed 10-Jan-2022 14:50:01

    Any ideas?
    3 replies
    Duncan Godwin
    Running from external console seems to work as expected

    Hello, we've noticed a strange behavior in play-json, and we don't know if it what's expected or not.

    When we parse data containing invalid characters, play-json throws an exception :

    @ val ctrlChar:Char = 0x2
    ctrlChar: Char = '\u0002'
    @ Json.parse(s"{\"hello\": $ctrlChar}")
    com.fasterxml.jackson.core.JsonParseException: Illegal character ((CTRL-CHAR, code 2)): only regular white space (\r, \n, \t) is allowed between tokens
     at [Source: (String)"{"hello": }"; line: 1, column: 12]

    In our case, the parser reads compressed data from an old cached version.

    We would expect it to return a JsError, which would be safer, instead of throwing the exception. Is it normal (if so, is it documented somewhere?) or is it a bug?

    Sorry, we encounter it after a validate Json.parse(data).validate[T] that's why I would expect a JsError, but indeed, if parse throws an exception, it's too late ๐Ÿ˜•
    Alexis Hernandez

    com.fasterxml.jackson.core.JsonParseException: Illegal character ((CTRL-CHAR, code 2)): only regular white space (\r, \n, \t) is allowed between tokens

    @joelvim:matrix.org this error happens because you are using the single char as a valid json value which is not, you would need to wrap it in quotes like s"""{"hello": "$ctrlChar"}""", in this case, now play complains that you need to escape the character in order to include it in a string: com.fasterxml.jackson.core.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 2)): has to be escaped using backslash to be included in string value

    Sorry, we encounter it after a validate Json.parse(data).validate[T] that's why I would expect a JsError, but indeed, if parse throws an exception, it's too late

    Unfortunately, play-json doesn't provide a safe parse function, you would need to catch the exception like Try(Json.parse(...)), validate handles errors when you have a valid json but it doesn't correspond to the type you are expecting to parse

    1 reply
    I understand that this JSON is not valid, that is not my point, it was more about throwing an exception when parsing invalid json vs returning a value that would encode the error (like a Try). I thought parse was returning a JsResult, so it would have been cool to get a JsError in this case, but it is validate that returns it.
    IMHO it would be cool scaladoc (or any other way like annotations?) could specify that exceptions can be thrown in order to guide users and prevent some mistakes.
    Alexis Hernandez
    I'd suggest you to create a ticket (https://github.com/playframework/play-json/issues/new/choose), I believe that it would be ideal to get a safe api for parsing json
    1 reply
    Matthias Kurz
    Hey @/all!
    We set up a Discord server for Play: https://discord.gg/g5s2vtZ4Fa
    Since we felt that Gitter lost popularity and more communities are moving to Discord (like the Scala team) we are planning to retire Play's Gitter channels in the near future.
    See you on Discord!
    Taehyun Park
    Can't create a new project.
    Richard Moorhead

    For Play 2.8 how do we retrieve reference to the default actor system?

    Is this correct? Play.materializer.system

    Alexis Hernandez
    just inject it, class ServiceX @Inject()(system: ActorSystem) {...}
    Richard Moorhead
    Perhaps, but thats not what I asked.
    Do you know how to use 1.2 binding in Play SOAP Client?
    I am trying to make a graphql call with WSRequest which takes in a query, variables and file. Basically I want to upload an image successfully. I have managed to add in query and variables successfully. The file addition is where the issue is. There is a post option to upload a file available in the documentation, however, I do not see how both of them can go in together. Has anyone successfulyy achieved this?

    Library and Packaging - Unknown

    I have created a play framework project. I have created a lib folder and add 2 jars to the lib directory.

    When running via intellij and SBT compiles fine...However it is not picking up after the application is up.


    #1 - How to make it work or the way to add the jar in runtime which is present in the lib folder?

    #2 - Also, how to add the libraries in the lib folder and package the app as exe or one executable jar?

    Thanks in advance

    Can anyone please comment on the above?

    I have a working play framework application

    How to create a executable jar or exe as bundled as one with all dependencies?


    Alexis Hernandez
    sbt dist is the way
    Hello everyone, can we run play applications like
    object Main extends App { // play application here } ?
    Antoine Doeraene
    You can, you then simply need to call the prod or dev main method of play from there. I don't recall how it's called but it is in the docs ๐Ÿ™‚
    @AlexITC what is the difference between sbt dist vs publishLocal ?
    Alexis Hernandez
    sbt dist prepares the app for deployment while sbt publishLocal is intended to publish libraries locally
    hi guys.. i been try upgrade play framework from 2.1.5 to 2.2.0 ... is this possible on2022?
    this addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.0")
    return on module not found
    resolvers += "Typesafe repository" at "https://scala.jfrog.io/ui/native/sbt-plugin-releases/"
    Alexis Hernandez
    I think that such old version depended on bintray which doesn't work anymore
    so, best alternative is to upgrade, otherwise, you would need to compile the artifacts manually
    yes i will upgrade manually to 2.8
    thank you
    I come across a nice project - https://github.com/simon987/sist2 and just for reference

    hi hi! i recent upgrade projecto from play 2.5 to 2.8
    On cache Before:
    Cache.set("usuariosSesion", usuariosSesion);
    from import play.cache.Cache;

    After follow documentation from play on java
    on .sbt:
    libraryDependencies += "com.github.ben-manes.caffeine" % "caffeine" % "3.0.6"
    and then simple import play.cache.*;
    but for some reason does not recognize it

    some ideas? other option?

    Is there any tutorial or Go-to place on how to use Elastic-Search queries/documents using Play framework?
    package to a jar ,run it ,say java.lang.ClassNotFoundException: play.core.server.ProdServerStart
    how to resolve it ?
    Alexis Hernandez
    you likely got a binary incompatibility dependency in your classpath, run sbt evicted to try finding that out
    Hi all, by default AllowedHostsFilterreturns 400 how can i override this and redirect to another domain instead ?

    Hi Guys! Im working on eclipse 2.8.13 on scala 2.13 and i want to connecto to sql server my application.conf is


    return Cannot initialize to database [default] ondb.default.url
    seem to be ok , any ideas?
    library dependencie
    libraryDependencies += "com.microsoft.sqlserver" % "mssql-jdbc" % "11.1.1.jre18-preview"

    Can I use gRPC with Scala 2.13?
    Hi! someone have or had error when trying connect to sql server from play 2.8.13 on eclipse java project?
    For XML handling is there a Scala library which allows validation of incoming XML just like we do for JSON (using case classes and libraries such as io.circe) ?
    I am using Play 2.6 and Scala 2.12
    Rฤƒzvan Rotaru
    Are old jar files which were previously hosted by Bintray available somewhere? I'm thinking of Play Framework 2.1 and 2.2.