Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

playframework 2.3.4 with java 8u25 error on startup

I'm using java8 with play2,with this configuration.

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.")
}

It works but in startup i receive the following exception. .......................................................... ..........................................................

--- (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 
like image 794
Bruno Lee Avatar asked Nov 19 '14 14:11

Bruno Lee


2 Answers

The problem is that you cannot use ANy java 8 feature in model of play 2.3 classes like lambdas because ebean ASM dont understand bytecode.

We need wait plays new version but in roadmap looks like in next version play will preffer JPA instead ebean

like image 189
Bruno Lee Avatar answered Nov 13 '22 15:11

Bruno Lee


I ran into the same problem, and created a workaround until the Play Framework is able to update the included version of ebean: https://github.com/beowulfe/ebean-jdk8-fix

like image 2
AndyLintner Avatar answered Nov 13 '22 14:11

AndyLintner