Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Andrey
    @green-creeper

    Hi guys. I'm using play-grpc-runtime and trying to handle errors properly. When I match the exception type and return something like this

    case Failure(e: KeycloakRealmException) =>
            Future.failed(Status.NOT_FOUND.withDescription(e.getMessage).asRuntimeException())

    I see this message in the log

    [error] a.a.ActorSystemImpl - Unhandled error: [NOT_FOUND: Can't find tenant with id ab7ff915-9843-402a-aa87-60f86dc41f45].
    io.grpc.StatusRuntimeException: NOT_FOUND: Can't find tenant with id ab7ff915-9843-402a-aa87-60f86dc41f45
        at io.grpc.Status.asRuntimeException(Status.java:524)

    And the service returns this

    ERROR:
      Code: Internal
      Message:

    Any ideas why it could be unhandled? Could it be the limitation of the play-grpc-runtime?

    Andrey
    @green-creeper

    Moreover,
    If I make method like this

    override def delete(in: DeleteClientRequest): Future[DeleteClientResponse] =
        Future.failed(Status.NOT_FOUND.withDescription("WTF").asRuntimeException())

    I see the same

    [error] a.a.ActorSystemImpl - Unhandled error: [NOT_FOUND: WTF].
    io.grpc.StatusRuntimeException: NOT_FOUND: WTF
        at io.grpc.Status.asRuntimeException(Status.java:524)

    And output

    ERROR:
      Code: Internal
      Message:
    Andrey
    @green-creeper
    Ok, regarding above problem, there should be special exception type Future.failed(new GrpcServiceException(status))
    Tran Thien Hoa
    @glhoatt
    Sorry if I bother you. I want to use I18n to setup multi language for java project. But I can not find tutorial for it. Could you help me? Thank you very much!
    prouzpe3
    @prouzpe3
    Hello, do you guys know of any "larger" project that uses subprojects I could look at? Preferably in JavaPlay.
    Paul Schwarz
    @paulschwarz
    Morning. I working in a Java environment using Gradle. I want to build a library that I can publish to a Nexus repo and then pull into Play. If it had no dependency on Play, that would be fairly straight forward. However, in this case, the library is aware of Play and therefore needs Play dependencies at least at compile time. What artefact should I include in my Java project to supply the compile-time dependencies for Play?
    Dan Ellis
    @danellis
    How do I stop sbt-play from marking my public directory as a resources root in IntelliJ?
    andriisalivonov
    @andriisalivonov

    I've noticed that there is no example for gRPC in https://github.com/playframework/play-samples/tree/2.6.x although I cannot find which problem might not allow to do it. Since in 2.6.x akka http sever supported everything should work.

    Is there any potential problem that can stop me from implementing gRPC on play 2.6.x?

    Will Sargent
    @wsargent
    Play 2.6 doesn’t mean Akka 2.6
    sjaanus
    @sjaanus
    hi, any tips what to do with requests getting net::ERR_CONNECTION_RESET after couple of minutes? I have play 2.6 and application.conf has set:
    play.server.http.idleTimeout=3600
    play.server.akka.requestTimeout=3600
    Christian Hessenbruch
    @bastaware
    Hi there. Anyone here confident enough with Play WebSockets to answer a simple (?) question? :D
    Antoine Doeraene
    @sherpal
    shoot the question, I (we)'ll do our best <3
    Christian Hessenbruch
    @bastaware

    I've created a backend that runs on port 9000. It serves HTTP and websocket. I've installed lighttpd in front to handle SSL. Everything works as expected when I access the backend directly on port 9000, but when accessing via wss it stops working.

    After a lot of investigating I discovered that lighttpd appends 'close' when forwarding the websocket request to that backend. I got assistance from the author of lighttpd, and he tells me to make sure that the backend doesn't close the connection.

    Antoine Doeraene
    @sherpal
    also, when you say it closes, do you mean directly? Because Play does not keep alive connections more than 1 minute if there is no message passing by (you need to manually send "heart beat" messages if the connection can idle for so long)
    Christian Hessenbruch
    @bastaware

    No I've only tried the actor model. It seems simple and fit the application great.

    Yes it closes instantly. Here is a screenshot (the last image) that shows a connection made from Postman.

    This is how the request looks when Postman connects directly to port 9000:

    GET /ws HTTP/1.1
    Sec-WebSocket-Version: 13
    Sec-WebSocket-Key: kiliUHe9b7TjqgBp5sNVJQ==
    Connection: Upgrade
    Upgrade: websocket
    Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
    Host: xxxxxx.com:9000

    This is what hits the backend server when doing a wss request from Postman to lighttpd

    GET /ws HTTP/1.1
    Host: xxxxxx.com
    Sec-WebSocket-Version: 13
    Sec-WebSocket-Key: vrPH46cZiHuAHfkVS1BxGw==
    Upgrade: websocket
    Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
    X-Forwarded-For: 213.32.242.139
    X-Host: xxxxxx.com
    X-Forwarded-Host: xxxxxx.com
    X-Forwarded-Proto: https
    Connection: close, upgrade

    Notice how lighttpd preprends close to "Connection" argument
    Christian Hessenbruch
    @bastaware
    I guess this tells Play to close the connection. But according to the author of lighttpd, this is not correct behavior.
    Antoine Doeraene
    @sherpal
    hum, and an even dumber question: does the connection close if you connect to play directly? without going through lighttpd?
    Christian Hessenbruch
    @bastaware
    It just keeps alive :) Life is great when I connect directly.
    3 replies
    Ido Tamir
    @idot
    Hello, is there a known problem with playframework 2.8.x and java16 and the guice module?
    nice: just had to add "com.google.inject" % "guice" % "5.0.1", and the tests run again!
    Ido Tamir
    @idot
    A warning, somehow deployment does not work with java16 playframework/playframework#10731 is sceduled for play 2.9.0
    Aäron Munsters
    @aaronmunsters
    Hi everyone, I was wondering if there is a possibility to merge the logic for different actions that are duplicated to capture the possibilities to handle different types of requests, say merging the following to actions their duplicated logic:
    object AuthenticatedUserActionHandler {
      private val loginRequired: (String, String) =
        Global.FLASH_WARNING_KEY -> "You are required to be logged in to view this content"
    
      class AuthenticatedUserAction @Inject()(parser: BodyParsers.Default)(
        implicit ec: ExecutionContext) extends ActionBuilderImpl(parser) {
    
        override def invokeBlock[A](request: Request[A], block: Request[A] => Future[Result]): Future[Result] = {
          request.session.get(global.Global.SESSION_USERNAME_KEY) match {
            case None => Future.successful(Redirect(routes.HomeController.index).flashing(loginRequired))
            case Some(_) => block(request)
          }
        }
    
      }
    
      class AuthenticatedUserActionMessageRequest @Inject()(parser: BodyParsers.Default, messagesApi: MessagesApi)(
        implicit ec: ExecutionContext) extends MessagesActionBuilderImpl(parser, messagesApi) {
    
        override def invokeBlock[A](request: Request[A], block: MessagesRequest[A] => Future[Result]): Future[Result] = {
          request.session.get(global.Global.SESSION_USERNAME_KEY) match {
            case None => Future.successful(Redirect(routes.HomeController.index).flashing(loginRequired))
            case Some(_) => block(new MessagesRequest[A](request, messagesApi))
          }
        }
    
      }
    }
    Will Sargent
    @wsargent
    @aaronmunsters you can compose actions
    Aäron Munsters
    @aaronmunsters
    Alright, thank you!
    qomosoloto
    @qomosoloto
    Hi everyone, I'm trying to upgrade project from play-2.6 to play-2.7. I changed sbt-plugin version and also upgraded scala version from 2.12 to 2.13, but failed to re-import project:
    /usr/lib/jvm/java-8-graalvm/bin/java -Djline.terminal=jline.UnsupportedTerminal -Dsbt.log.noformat=true -Dfile.encoding=UTF-8 -Xmx4096M -Dsbt.repository.config=/home/matrixer/.sbt/repositories -Dsbt.boot.lock=false -Didea.managed=true -Dfile.encoding=UTF-8 -Didea.installation.dir=/home/matrixer/idea -jar /home/matrixer/.local/share/JetBrains/IntelliJIdea2021.1/Scala/launcher/sbt-launch.jar
    [info] welcome to sbt 1.4.9 (GraalVM Community Java 1.8.0_292)
    [info] loading global plugins from /home/matrixer/.sbt/1.0/plugins
    [info] loading settings for project guandata-core-upd-build from assembly.sbt,plugins.sbt,sbt-ui.sbt ...
    [info] loading project definition from /home/matrixer/scala/guandata-core-upd/project
    /home/matrixer/scala/guandata-core-upd/build.sbt:25: warning: a pure expression does nothing in statement position; multiline expressions might require enclosing parentheses
    (queryGenerator / Test / test).value
    ^
    [info] loading settings for project root from build.sbt,webpack.sbt ...
    [info] loading settings for project pluginApi from build.sbt ...
    [info] loading settings for project pluginJobserverApi from build.sbt ...
    [info] loading settings for project base from build.sbt ...
    [info] loading settings for project jdbcDrivers from build.sbt ...
    [info] loading settings for project guandataAwsSdkBundle from build.sbt ...
    [info] loading settings for project jooq from build.sbt ...
    [info] loading settings for project queryGenerator from build.sbt ...
    [info] loading settings for project common from build.sbt ...
    [info] loading settings for project server from build.sbt ...
    [info] loading settings for project admin from build.sbt ...
    [info] loading settings for project guandataWebPlugin from build.sbt ...
    [info] loading settings for project guandataFileSystemPlugin from build.sbt ...
    [info] resolving key references (15296 settings) ...
    [info] set current project to guandata-root (in build file:/home/matrixer/scala/guandata-core-upd/)
    [info]  Running with settings: BuildSettingsGuandata(master,62c513e4b0ba26797536bcab9d8ed9d75e88703a,62c513e,20210721,2021-07-21T19:44:54.512+08:00[Asia/Shanghai])
    [info] sbt server started at local:///home/matrixer/.sbt/1.0/server/52b24a5e2bda88ad5cfb/sock
    [info] started sbt server
    [guandata-root] $
    ;set _root_.scala.collection.Seq(historyPath := None,shellPrompt := { _ => "" },SettingKey[_root_.scala.Option[_root_.sbt.File]]
    ("sbtStructureOutputFile") in _root_.sbt.Global := _root_.scala.Some(_root_.sbt.file("/tmp/sbt-structure.xml"))
    ,SettingKey[_root_.java.lang.String]("sbtStructureOptions") in _root_.sbt.Global := "download, resolveClassifiers")
    [info] Defining Global / sbtStructureOptions, Global / sbtStructureOutputFile and 1 others.
    [info] The new values will be used by cleanKeepGlobs
    [info]     Run `last` for details.
    [info] Reapplying settings...
    [info] set current project to guandata-root (in build file:/home/matrixer/scala/guandata-core-upd/)
    [info]  Running with settings: BuildSettingsGuandata(master,62c513e4b0ba26797536bcab9d8ed9d75e88703a,62c513e,20210721,2021-07-21T19:44:56.379+08:00[Asia/Shanghai])
    [info] Applying State transformations org.jetbrains.sbt.CreateTasks from /home/matrixer/.local/share/JetBrains/IntelliJIdea2021.1/Scala/repo/org/jetbrains/scala/sbt-structure-extractor_2.12_1.0/2021.1.1/sbt-structure-extractor-2021.1.1.jar
    [info] Reapplying settings...
    [info] set current project to guandata-root (in build file:/home/matrixer/scala/guandata-core-upd/)
    [info]  Running with settings: BuildSettingsGuandata(master,62c513e4b0ba26797536bcab9d8ed9d75e88703a,62c513e,20210721,2021-07-21T19:44:56.93+08:00[Asia/Shanghai])
    [warn]
    [warn]     Note: Unresolved dependencies path:
    [warn]
    [warn]     Note: Unresolved dependencies path:
    [error] stack trace is suppressed; run 'last common / update' for the full output
    [error] stack trace is suppressed; run 'last codegen / update' for the full output
    [error]
    [error] (ssExtractDependencies) sbt.librarymanagement.ResolveException: Error downloading com.typesafe.play:play_2.12:[2.6,2.7),[2.60,2.70),[2.600,2.700),[2.6000,2.7000),[2.60000,2.70000)
    [error]   No version found for [2.60000,2.70000) in
    [error]   No version found for [2.60000,2.70000) in
    [error]   not found: /home/matrixer/.ivy2/localcom.typesafe.play/play_2.12
    [error]   No version found for [2.60000,2.70000) in https://repo1.maven.org/maven2/com/typesafe/play/play_2.12/maven-metadata.xml
    [error]   No version found for [2.60000,2.70000) in https://maven.aliyun.com/nexus/content/groups/public/com/typesafe/play/play_2.12/maven-metadata.xml
    [error]   not found: /home/matrixer/.m2/repository/com/typesafe/play/play_2.12/maven-metadata.xml
    [error]   not found: https://repository.aspose.com/repo/com/typesafe/play/play_2.12/maven-metadata.xml
    [error]   download error: Caught java.io.IOException: Server returned HTTP response code: 403 for URL: https://dl.bintray.com/guandata/guandata_oracle/com/typesafe/play/play_2.12/maven-metadata.xml (Server returned HTTP response code: 403 for URL: https://dl.bintray.com/guandata/guandata_oracle/com/typesafe/play/play_2.12/maven-metadata.xml) while downloading https://dl.bintray.com/guandata/guandata_oracle/com/typesafe/play/play_2.12/maven-metadata.xml
    [error]   download error: Caught java.io.IOException: Server returned HTTP response code: 403 for URL: https://dl.bintray.com/guandata/guandata_redshift/com/typesafe/play/play_2.12/maven-metadata.xml (Server returned HTTP response code: 403 for URL: https://dl.bintray.com/guandata/guandata_redshift/com/typesafe/play/play_2.12/maven-metadata.xml) while downloading https://dl.bintray.com/guandata/guandata_redshift/com/typesafe/play/play_2.
    12/maven-metadata.xml
    [error]   download error: Caught java.io.IOException: Server returned HTTP response code: 403 for URL: https://dl.bintray.com/guandata/odps/com/typesafe/play/play_2.12/maven-metadata.xml (Server returned HTTP response code: 403 for URL: https://dl.bintray.com/guandata/odps/com/typesafe/play/play_2.12/maven-metadata.xml) while downloading https://dl.bintray.com/guandata/odps/com/typesafe/play/play_2.12/maven-metadata.xml
    [error]   download error: Caught java.io.IOException: Server returned HTTP response code: 403 for URL: https://dl.bintray.com/guandata/hana/com/typesafe/play/play_2.12/maven-metadata.xml (Server returned HTTP response code: 403 for URL: https://dl.bintray.com/guandata/hana/com/typesafe/play/play_2.12/maven-metadata.xml) while downloading https://dl.bintray.com/guandata/hana/com/typesafe/play/play_2.12/maven-metadata.xml
    [error]   download error: Caught java.io.IOException: Server returned HTTP response code: 403 for URL: https://dl.bintray.com/guandata/calcite-avatica/com/typesafe/play/play_2.12/maven-metadata.xml (Server returned HTTP response code: 403 for URL: https://dl.bintray.com/guandata/calcite-avatica/com/typesafe/play/play_2.12/maven-metadata.xml) while downloading https://dl.bintray.com/guandata/calcite-avatica/com/typesafe/play/play_2.12/maven-metadata.xml
    [error]   download error: Caught java.io.IOException: Server returned HTTP response code: 403 for URL: https://dl.bintray.com/guandata/Tera/com/typesafe/play/play_2.12/maven-metadata.xml (Server returned HTTP response code: 403 for URL: https://dl.bintray.com/guandata/Tera/com/typesafe/play/play_2.12/maven-metadata.xml) while downloading https://dl.bintray.com/guandata/Tera/com/typesafe/play/play_2.12/maven-metadata.xml
    [error]   No version found for [2.60000,2.70000) in https://app.mayidata.com/nexus/repository/maven-releases/com/typesafe/play/play_2.12/maven-metadata.xml
    [error] (codegen / ssExtractDependencies) sbt.librarymanagement.ResolveException: Error downloading com.typesafe.play:play_2.12:[2.6,2.7),[2.60,2.70),[2.600,2.700),[2.6000,2.7000),[2.60000,2.70000)
    [error]   No version found for [2.60000,2.70000) in
    [error]   No version found for [2.60000,2.70000) in
    [error]   not found: /home/matrixer/.ivy2/localcom.typesafe.play/play_2.12
    [error]   No version found for [2.60000,2.70000) in htt
    qomosoloto
    @qomosoloto
    Why the errors are all about play_2.12?
    Ross
    @ross-t
    Is there a non-Bintray repo hosting com.typesafe.play:sbt-plugin and friends?
    Justin Reeves
    @justinallenreeves
    @ross-t Yes, everyone migrated over. It should redirect now.
    Ross
    @ross-t
    @justinallenreeves Thanks!
    Justin Reeves
    @justinallenreeves
    I’m having some trouble with dependency injection/guice with Scala Playframework.
    Given a classes MyController, MyService and MyRequestContext
    MyController, MyService are injected classes. MyService is injected into MyController
    I have a MyRequestContext object produced during my action composition. I’d like to make this available as an implicit class parameter of MyService in an injected class, per each request.
    I’m trying figure out how to do that. I can’t inject it, it doesn’t exist till the request happens. I can make it a method parameter but that gets very verbose. I can break MyService from the DI and instead instanciate it manually per request. This last one works but why have Dependency Injection if I can’t use it in most places?
    Mahendra Chhimwal
    @MacSimmy
    We are using play2.2.1 and have plans to upgrade the framework to 2.8.x. I know it will be a very big task. Should I do that in steps like from 2.2.1 to 2.x.x -> 2.8.x or try directly migrating to latest version?
    Sergi Parisi
    @sparisi_gitlab
    I am new in this . We have an application that is really old and trying to resolve a dependency that is not found
    This is the issue
    Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
    [warn] com.typesafe.sbt:sbt-native-packager:0.7.1 (scalaVersion=2.10, sbtVersion=0.13)
    [warn]
    sbt.ResolveException: unresolved dependency: com.typesafe.sbt#sbt-native-packager;0.7.1: not found
    at sbt.IvyActions$.sbt$IvyActionsresolve(IvyActions.scala:213)atsbt.IvyActionsresolve(IvyActions.scala:213) at sbt.IvyActionsanonfun$update$1.apply(IvyActions.scala:122)
    at sbt.IvyActions
    KaTeX parse error: Can't use function '$' in math mode at position 8: anonfun$̲update$1.apply(…: anonfun$update$1.apply(IvyActions.scala:121)
            at sbt.IvySbt$Module
    anonfun$withModule$1.apply(Ivy.scala:116)
    at sbt.IvySbt$Module
    KaTeX parse error: Can't use function '$' in math mode at position 8: anonfun$̲withModule$1.ap…: anonfun$withModule$1.apply(Ivy.scala:116)
            at sbt.IvySbt
    anonfun$withIvy$1.apply(Ivy.scala:104)
    at sbt.IvySbt.sbt$IvySbt
    KaTeX parse error: Can't use function '$' in math mode at position 7: action$̲1(Ivy.scala:51)…: action$1(Ivy.scala:51)
            at sbt.IvySbt
    anon$3.call(Ivy.scala:60)
    at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:98)
    at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock
    KaTeX parse error: Can't use function '$' in math mode at position 19: …hChannelRetries$̲1(Locks.scala:8…: withChannelRetries$1(Locks.scala:81)
            at xsbt.boot.Locks$GlobalLock
    anonfun$withFileLock$1.apply(Locks.scala:102)
    at xsbt.boot.Using$.withResource(Using.scala:11)
    at xsbt.boot.Using$.apply(Using.scala:10)
    at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:62)
    at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:52)
    at xsbt.boot.Locks$.apply0(Locks.scala:31)
    at xsbt.boot.Locks$.apply(Locks.scala:28)
    Current plugins.sbt file

    // Comment to get more information during initialization
    logLevel := Level.Warn

    // The Typesafe repository
    resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

    // Use the Play sbt plugin for Play projects
    addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.4")

    addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.7.1")

    Could anyone please help me with us?
    N.S. Cutler
    @godenji

    Should I do that in steps like from 2.2.1 to 2.x.x -> 2.8.x or try directly migrating to latest version?

    @MacSimmy do it in steps and follow migration guide for each major release

    jilen
    @jilen
    Hi did someone hit this playframework/playframework#10936 , any idea how to investigate such case ?
    Armin Primadi
    @aprimadi
    Hello, I'm having problem with play framework default logger. Somehow it's not logging anything to STDOUT even when I set the root level to INFO
    // web/conf/logback.xml
    <configuration>
      ...
    
      <logger name="play" level="INFO" />
      <logger name="application" level="DEBUG" />
    
      <root level="INFO">
        <appender-ref ref="ASYNCFILE" />
        <appender-ref ref="ASYNCSTDOUT" />
        <appender-ref ref="Sentry" />
      </root>
    
    </configuration>
    My logback configuration. As far as I know I didn't change anything beside adding Sentry
    Armin Primadi
    @aprimadi
    Actually, never mind, I chose to ditch default Play logger and use scribe instead