[2.4.0] Docker image packages Java 7 - needs Java 8

317 views
Skip to first unread message

Marcus Haebler

unread,
May 30, 2015, 1:05:22 PM5/30/15
to play-fr...@googlegroups.com
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?

ra...@qmerce.com

unread,
Jun 14, 2015, 10:08:38 AM6/14/15
to play-fr...@googlegroups.com
Seems like a "feature" docker sbt plugin pulls "latest" by default which is java 7 for some reason. 

Ben McCann

unread,
Jun 23, 2015, 9:59:28 PM6/23/15
to play-fr...@googlegroups.com
I think the cleanest way of fixing this would be to update "latest" to Java 8 on DockerHub. I filed an issue for this and the Docker folks seem receptive to the idea.

https://github.com/docker-library/java/issues/43

-Ben

Reply all
Reply to author
Forward
0 new messages