General discussion of Play: https://www.playframework.com/ | Code of Conduct: https://www.lightbend.com/conduct | Forums: https://discuss.playframework.com | Commercial support from https://www.lightbend.com/
[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
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?
Json.parse(data).validate[T]
that's why I would expect a JsError, but indeed, if parse throws an exception, it's too late ๐
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
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.
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
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?
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"