Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Duncan Godwin
    @digitalpulse_twitter
    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
    @digitalpulse_twitter
    Running from external console seems to work as expected
    joelvim
    @joelvim:matrix.org
    [m]

    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]
      com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1851)
      com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:707)
      com.fasterxml.jackson.core.base.ParserMinimalBase._throwInvalidSpace(ParserMinimalBase.java:685)
      com.fasterxml.jackson.core.json.ReaderBasedJsonParser._skipColon2(ReaderBasedJsonParser.java:2263)
      com.fasterxml.jackson.core.json.ReaderBasedJsonParser._skipColon(ReaderBasedJsonParser.java:2182)
      com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:711)
      play.api.libs.json.jackson.JsValueDeserializer.deserialize(JacksonJson.scala:229)
      play.api.libs.json.jackson.JsValueDeserializer.deserialize(JacksonJson.scala:143)
      play.api.libs.json.jackson.JsValueDeserializer.deserialize(JacksonJson.scala:138)
      com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:4497)
      com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2730)
      play.api.libs.json.jackson.JacksonJson$.parseJsValue(JacksonJson.scala:285)
      play.api.libs.json.StaticBinding$.parseJsValue(StaticBinding.scala:17)
      play.api.libs.json.Json$.parse(Json.scala:173)
      ammonite.$sess.cmd4$.<clinit>(cmd4.sc:1)

    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?

    joelvim
    @joelvim:matrix.org
    [m]
    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
    @AlexITC

    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
    joelvim
    @joelvim:matrix.org
    [m]
    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
    @AlexITC
    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
    @mkurz
    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
    @njovy
    Can't create a new project.
    Richard Moorhead
    @autodidacticon

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

    Is this correct? Play.materializer.system

    Alexis Hernandez
    @AlexITC
    just inject it, class ServiceX @Inject()(system: ActorSystem) {...}
    Richard Moorhead
    @autodidacticon
    Perhaps, but thats not what I asked.
    Pawel
    @odwrotnie
    Do you know how to use 1.2 binding in Play SOAP Client?
    sharonsyra
    @Sharonsyra
    Hello,
    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?
    goodev2021
    @goodev2021

    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.

    Problems:

    #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

    goodev2021
    @goodev2021
    Can anyone please comment on the above?
    goodev2021
    @goodev2021

    I have a working play framework application

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

    Thanks

    Alexis Hernandez
    @AlexITC
    sbt dist is the way
    lastsweetpotato
    @ahmetgurbuz1
    Hello everyone, can we run play applications like
    object Main extends App { // play application here } ?
    Antoine Doeraene
    @sherpal
    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 ๐Ÿ™‚
    techstack2022
    @techstack2022
    @AlexITC what is the difference between sbt dist vs publishLocal ?
    Alexis Hernandez
    @AlexITC
    sbt dist prepares the app for deployment while sbt publishLocal is intended to publish libraries locally
    makefernandez
    @makefernandez
    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
    @AlexITC
    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
    makefernandez
    @makefernandez
    yes i will upgrade manually to 2.8
    thank you
    goodev2021
    @goodev2021
    I come across a nice project - https://github.com/simon987/sist2 and just for reference
    makefernandez
    @makefernandez

    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?

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

    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

    db.default.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
    db.default.url="jdbc:sqlserver://127.0.0.1:1433;databaseName=PRE_PROD;"
    db.default.user="sa"
    db.default.password="test12"

    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"

    Jeremias
    @Dfic_twitter
    Can I use gRPC with Scala 2.13?
    makefernandez
    @makefernandez
    @makefernandez
    Hi! someone have or had error when trying connect to sql server from play 2.8.13 on eclipse java project?
    https://stackoverflow.com/questions/72290735/for-sqlserver-please-explicitly-choose-either-sqlserver16-or-sqlserver17-as-the
    NKM
    @nkmittal
    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
    @roti
    Are old jar files which were previously hosted by Bintray available somewhere? I'm thinking of Play Framework 2.1 and 2.2.