我有一个功能齐全的 Java Play 2.0.4 应用程序工作得很好,我正在尝试迁移到 2.1
我遵循了迁移指南并实施了所有更改。该应用程序编译并正确启动。但是,当我尝试访问任何页面时,我得到NoSuchFieldError
:
play.api.Application$$anon$1: Execution exception[[RuntimeException: java.lang.NoSuchFieldError: Application]]
当然,Application
控制器存在并且路由是在其中定义的conf/routes
(就像在工作 2.0.4 版本上迁移之前一样)。
从堆栈跟踪中,我怀疑它与路由器有关。这是完整的跟踪:
play.api.Application$$anon$1: Execution exception[[RuntimeException: java.lang.NoSuchFieldError: Application]]
at play.api.Application$class.handleError(Application.scala:289) ~[play_2.10.jar:2.1.0]
at play.api.DefaultApplication.handleError(Application.scala:383) [play_2.10.jar:2.1.0]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anon$2$$anonfun$handle$1.apply(PlayDefaultUpstreamHandler.scala:132) [play_2.10.jar:2.1.0]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anon$2$$anonfun$handle$1.apply(PlayDefaultUpstreamHandler.scala:128) [play_2.10.jar:2.1.0]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10.jar:2.1.0]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10.jar:2.1.0]
java.lang.RuntimeException: java.lang.NoSuchFieldError: Application
at play.libs.F$Promise$6.apply(F.java:401) ~[play_2.10.jar:2.1.0]
at scala.concurrent.Future$$anonfun$map$1.liftedTree2$1(Future.scala:253) ~[scala-library.jar:na]
at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:249) ~[scala-library.jar:na]
at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:249) ~[scala-library.jar:na]
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:29) ~[scala-library.jar:na]
at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.liftedTree1$1(BatchingExecutor.scala:67) ~[akka-actor_2.10.jar:na]
Caused by: java.lang.NoSuchFieldError: Application
at views.html.login$.apply(login.template.scala:54) ~[na:na]
at views.html.login$.render(login.template.scala:109) ~[na:na]
at views.html.login.render(login.template.scala) ~[na:na]
at controllers.Application.login(Application.java:38) ~[na:na]
at Routes$$anonfun$routes$1$$anonfun$applyOrElse$1$$anonfun$apply$1.apply(routes_routing.scala:241) ~[na:na]
at Routes$$anonfun$routes$1$$anonfun$applyOrElse$1$$anonfun$apply$1.apply(routes_routing.scala:241) ~[na:na]
这是我的Build.scala
文件:
import sbt._
import Keys._
import play.Project._
object ApplicationBuild extends Build {
val appName = "rossirixweb"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
javaCore,
javaJdbc,
javaEbean,
"org.apache.xmlrpc" % "xmlrpc" % "3.0",
"commons-httpclient" % "commons-httpclient" % "3.1",
"com.google.code.gson" % "gson" % "2.2.2",
"junit" % "junit" % "4.11",
"org.mongodb" % "mongo-java-driver" % "2.8.0",
"org.jongo" % "jongo" % "0.3",
"mysql" % "mysql-connector-java" % "5.1.22",
"com.typesafe" %% "play-plugins-mailer" % "2.1.0",
"be.objectify" %% "deadbolt-java" % "2.1-RC2"
)
val main = play.Project(appName, appVersion, appDependencies).settings(
resolvers += Resolver.url("My GitHub Play Repository", url("http://alexanderjarvis.github.com/releases/"))(Resolver.ivyStylePatterns),
resolvers += Resolver.url("Objectify Play Repository", url("http://schaloner.github.com/releases/"))(Resolver.ivyStylePatterns),
resolvers += Resolver.url("Objectify Play Snapshot Repository", url("http://schaloner.github.com/snapshots/"))(Resolver.ivyStylePatterns)
)
}
我无法启动并运行该应用程序。
有任何想法吗?谢谢!
更新:我添加了完整Build.scala
文件以供参考。