Just started working with play 2.4.0 and I am trying to package a Java project as docker.
It seems that the Java 8 requirement for 2.4.0 hasn't been translated to the docker build configuration. The docker image I get includes Java 7 - not Java 8:
$ docker run -p 9000:9000 myapp:0.8
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/typesafe/config/ConfigException : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at play.core.server.ProdServerStart$.readServerConfigSettings(ProdServerStart.scala:81)
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:42)
at play.core.server.ProdServerStart$.main(ProdServerStart.scala:27)
at play.core.server.ProdServerStart.main(ProdServerStart.scala)
$ docker inspect myapp:0.8 | grep -i java
"JAVA_VERSION=7u79",
"JAVA_DEBIAN_VERSION=7u79-2.5.5-1~deb8u1"
"JAVA_VERSION=7u79",
"JAVA_DEBIAN_VERSION=7u79-2.5.5-1~deb8u1"
I had opened this as an issue on GitHub but got redirected to the mailing list:
https://github.com/playframework/playframework/issues/4579
After I had posted the issue I figured out a workaround. In build.sbt configure:
dockerBaseImage := "java:8-jre"
per
http://www.scala-sbt.org/sbt-native-packager/formats/docker.html#settings and a recent change in sbt-docker (
https://github.com/marcuslonnberg/sbt-docker/commit/36594163b0783ccc8aaa61af5dbd06111b366165)
I still think this is a bug in play-2.4.0 since it should configure the docker build with the correct defaults for a Java 8 image.
Thoughts?