How to run Play 2.2.x with Akka 2.3.x?

前端 未结 2 481
攒了一身酷
攒了一身酷 2020-12-19 00:18

Is there any way to combine akka 2.3 and play 2.2? For now I\'m getting AbstractMethodError while running such application. I need to have them both in one app because Akka

相关标签:
2条回答
  • 2020-12-19 00:57

    Akka 2.3 and Play 2.2 are just binary incompatible that means that you can compile Play 2.2 with Akka 2.3 as dependency and publish it to your local ivy or company repository.

    In my case no AbstractMethodError occurred with the patched Play version. Try to patch Play this way:

    1. Checkout the source code of a tagged Play version, e.g., https://github.com/playframework/playframework/releases/tag/2.2.2
    2. Switch into the framework folder (that's the sbt project with the project subdirectory)
    3. Change the version number of Play and Akka dependency, e.g., https://github.com/schleichardt/Play20/commit/14b45c44924ce5b3ef2159c772bc5b0544c94658
    4. sbt publishLocal or sbt publish, for the latter you need to adjust publishing{Ivy,Maven}Repository and publishMavenStyle := true in framework/project/Build.scala
    5. (optional) Unless you've published the patch version of Play to your local Ivy repository (using publishLocal), you need to add a resolver to build.sbt and project/plugins.sbt
    6. In project/plugins.sbt set the patched Play sbt plugin, e.g., addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.2-akka-2.3.1")

    A demo is in https://github.com/schleichardt/event-sourcing-with-the-play-framework/tree/bf171720c43a1349555726cb11cffae4d967cc4b. The source code for the patched Play version is in https://github.com/schleichardt/Play20/tree/2.2.2-akka-2.3.1.

    Refer also to https://stackoverflow.com/a/22651261/1575096 for problems with an Akka 2.3 compiled Play, Jeff May was not able to use the WS library.

    Keep in mind that other libraries, for example ReactiveMongo with Play iteratees, may also depend on Play libraries and may load the unpatched version into the class path. In that case something like "group" %% "library" % "version" exclude("com.typesafe.play", "play") would help. In case of ReactiveMongo you need to compile it for Akka 2.3, too.

    With sbt 'show libraryDependencies' you can inspect the actual dependencies and their versions.

    0 讨论(0)
  • 2020-12-19 01:11

    Unfortunately you will have to wait for the Play team to publish a release that is compatible with Akka 2.3, or ask on their mailing list for instructions on how to properly build a Play distribution (since it seems that you didn’t actually use your rebuilt JARs).

    0 讨论(0)
提交回复
热议问题