迁移 Playframework 2.4.3 到 2.7.0 中的问题
Posted
技术标签:
【中文标题】迁移 Playframework 2.4.3 到 2.7.0 中的问题【英文标题】:Issue in Migration Playframework 2.4.3 to 2.7.0 【发布时间】:2019-05-06 11:45:19 【问题描述】:应用程序从 play 2.4.3 迁移到 2.7.0 我正在使用以下插件。
scalaVersion := "2.11.6"
sbt.version=1.2.7
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "4.1.0")
我得到以下堆栈跟踪:
java.lang.ArrayIndexOutOfBoundsException and Caused by: java.lang.ClassNotFoundException: play.Configuration
[error] Exception when compiling 1137 sources to /home/Documents/Codebase/target/scala-2.11/classes
[error] 65791
[error] scala.tools.asm.ClassWriter.findItemByIndex(ClassWriter.java:1755)
[error] scala.tools.asm.MethodWriter.getSize(MethodWriter.java:2045)
[error] scala.tools.asm.ClassWriter.toByteArray(ClassWriter.java:827)
[error] scala.tools.nsc.backend.jvm.GenASM$JBuilder.writeIfNotTooBig(GenASM.scala:529)
[error] scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genClass(GenASM.scala:1343) ...
[error] java.lang.NoClassDefFoundError: play/Configuration
[error] at play.db.ebean.ModelsConfigLoader.apply(ModelsConfigLoader.java:27)
[error] at play.db.ebean.ModelsConfigLoader.apply(ModelsConfigLoader.java:21)
[error] at play.ebean.sbt.PlayEbean$.$anonfun$configuredEbeanModels$4(PlayEbean.scala:153)
[error] at play.ebean.sbt.PlayEbean$.withClassLoader$1(PlayEbean.scala:130)...
[error] Caused by: java.lang.ClassNotFoundException: play.Configuration
[error] at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
[error] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error] at play.db.ebean.ModelsConfigLoader.apply(ModelsConfigLoader.java:27)
[error] at play.db.ebean.ModelsConfigLoader.apply(ModelsConfigLoader.java:21)
[error] at play.ebean.sbt.PlayEbean$.$anonfun$configuredEbeanModels$4(PlayEbean.scala:153)...
[error] java.lang.ArrayIndexOutOfBoundsException: 65791
[error] at scala.tools.asm.ClassWriter.findItemByIndex(ClassWriter.java:1755)
[error] at scala.tools.asm.MethodWriter.getSize(MethodWriter.java:2045)
[error] at scala.tools.asm.ClassWriter.toByteArray(ClassWriter.java:827)
[error] at scala.tools.nsc.backend.jvm.GenASM$JBuilder.writeIfNotTooBig(GenASM.scala:529)
[error] a.a.ActorSystemImpl - Internal server error, sending 500 response
akka.http.impl.util.One2OneBidiFlow$OutputTruncationException: Inner flow was completed without producing result elements for 1 outstanding elements
at akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$.apply(One2OneBidiFlow.scala:22)
at akka.http.impl.util.One2OneBidiFlow$OutputTruncationException$.apply(One2OneBidiFlow.scala:22)
at akka.http.impl.util.One2OneBidiFlow$One2OneBidi$$anon$1$$anon$4.onUpstreamFinish(One2OneBidiFlow.scala:97)
at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:504)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:378)
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:588)
at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:472)
at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:563)
at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:745)
at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:760)
【问题讨论】:
【参考方案1】:我从 2.4 迁移到 2.6。我相信对你来说一步一步做会更好。 首先,更新到 2.5,然后更新到 2.6 和 ...。 Play Framework 记录了如何从一个版本迁移到下一个版本。 链接: https://www.playframework.com/documentation/2.7.x/Migration25 https://www.playframework.com/documentation/2.7.x/Migration26 https://www.playframework.com/documentation/2.7.x/Migration27
但是对于你的具体问题https://www.playframework.com/documentation/2.7.x/Migration26#Scala-Configuration-API
【讨论】:
以上是关于迁移 Playframework 2.4.3 到 2.7.0 中的问题的主要内容,如果未能解决你的问题,请参考以下文章
使用 PlayFramework 2.4.2 的 ProvisionException
从播放框架 2.0.8 迁移到 2.1.0 错误:缓存播放已存在
迁移到 2.4.x (Java) 后在 Play Framework 中运行测试时出错