我使用带有play2的java8,使用此配置。
name := """shipping"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.1"
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache,
javaWs,
"org.apache.axis" % "axis" % "1.4",
"net.sf.barcode4j" % "barcode4j" % "2.1",
"xml-apis" % "xml-apis" % "1.4.01",
"javax.xml" % "jaxrpc-api" % "1.1",
"org.webjars" % "flot" % "0.8.0",
"org.webjars" % "bootstrap" % "2.3.1",
"commons-discovery" % "commons-discovery" % "0.4",
"postgresql" % "postgresql" % "9.1-901.jdbc4",
"wsdl4j" % "wsdl4j" % "1.6.2",
"org.apache.xmlgraphics" % "fop" % "1.0"
)
javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-Xlint")
LessKeys.compress := true
initialize := {
val _ = initialize.value
if (sys.props("java.specification.version") != "1.8")
sys.error("Java 8 is required for this project.")
}
它有效但在启动时我收到以下异常。 .................................................. ........ .................................................. ........
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Ctrl+D to stop and go back to the console...)
java.lang.ArrayIndexOutOfBoundsException: 52264
at com.avaje.ebean.enhance.asm.ClassReader.readClass(ClassReader.java:1976)
at com.avaje.ebean.enhance.asm.ClassReader.accept(ClassReader.java:464)
at com.avaje.ebean.enhance.asm.ClassReader.accept(ClassReader.java:420)
at com.avaje.ebean.enhance.agent.Transformer.detect(Transformer.java:252)
at com.avaje.ebean.enhance.agent.Transformer.transform(Transformer.java:106)
at com.avaje.ebean.enhance.agent.InputStreamTransform.transform(InputStreamTransform.java:55)
at com.avaje.ebean.enhance.agent.InputStreamTransform.transform(InputStreamTransform.java:39)
at com.avaje.ebean.enhance.ant.OfflineFileTransform.transformFile(OfflineFileTransform.java:141)
at com.avaje.ebean.enhance.ant.OfflineFileTransform.processPackage(OfflineFileTransform.java:124)
at com.avaje.ebean.enhance.ant.OfflineFileTransform.process(OfflineFileTransform.java:90)
at play.PlayCommands$$anonfun$PostCompile$1.apply(PlayCommands.scala:143)
at play.PlayCommands$$anonfun$PostCompile$1.apply(PlayCommands.scala:76)
at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:35)
at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:34)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
java.lang.ArrayIndexOutOfBoundsException: 60149
at com.avaje.ebean.enhance.asm.ClassReader.<init>(ClassReader.java:174)
at com.avaje.ebean.enhance.asm.ClassReader.<init>(ClassReader.java:153)
at com.avaje.ebean.enhance.agent.Transformer.detect(Transformer.java:251)
at com.avaje.ebean.enhance.agent.Transformer.transform(Transformer.java:106)
at com.avaje.ebean.enhance.agent.InputStreamTransform.transform(InputStreamTransform.java:55)
at com.avaje.ebean.enhance.agent.InputStreamTransform.transform(InputStreamTransform.java:39)
at com.avaje.ebean.enhance.ant.OfflineFileTransform.transformFile(OfflineFileTransform.java:141)
at com.avaje.ebean.enhance.ant.OfflineFileTransform.processPackage(OfflineFileTransform.java:124)
at com.avaje.ebean.enhance.ant.OfflineFileTransform.process(OfflineFileTransform.java:90)
at play.PlayCommands$$anonfun$PostCompile$1.apply(PlayCommands.scala:143)
at play.PlayCommands$$anonfun$PostCompile$1.apply(PlayCommands.scala:76)
at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:35)
at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:34)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
java.lang.ArrayIndexOutOfBoundsException: 45312
at com.avaje.ebean.enhance.asm.ClassReader.accept(ClassReader.java:465)
at com.avaje.ebean.enhance.asm.ClassReader.accept(ClassReader.java:420)
at com.avaje.ebean.enhance.agent.Transformer.detect(Transformer.java:252)
at com.avaje.ebean.enhance.agent.Transformer.transform(Transformer.java:106)
at com.avaje.ebean.enhance.agent.InputStreamTransform.transform(InputStreamTransform.java:55)
at com.avaje.ebean.enhance.agent.InputStreamTransform.transform(InputStreamTransform.java:39)
at com.avaje.ebean.enhance.ant.OfflineFileTransform.transformFile(OfflineFileTransform.java:141)
at com.avaje.ebean.enhance.ant.OfflineFileTransform.processPackage(OfflineFileTransform.java:124)
at com.avaje.ebean.enhance.ant.OfflineFileTransform.process(OfflineFileTransform.java:90)
at play.PlayCommands$$anonfun$PostCompile$1.apply(PlayCommands.scala:143)
at play.PlayCommands$$anonfun$PostCompile$1.apply(PlayCommands.scala:76)
at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:35)
at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:34)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
答案 0 :(得分:12)
问题是你不能在像lambdas这样的游戏2.3类的模型中使用ANy java 8特性,因为ebean ASM不理解字节码。
我们需要等待播放新版本,但在路线图中看起来像下一版本播放将会使JPA变为ebean
答案 1 :(得分:2)
我遇到了同样的问题,并创建了一个解决方法,直到Play Framework能够更新包含的ebean版本: https://github.com/beowulfe/ebean-jdk8-fix
答案 2 :(得分:0)
将build.sbt中的scala版本更改为最新的scalaVersion := "2.11.4"
。