Does Play 2.6.15 support java 9 and java 10

In the process of migration from Play 2.5 to Play 2.6 with java 9, we ended up with the following error

[error] a.a.ActorSystemImpl - Uncaught error from thread [application-akka.actor.default-dispatcher-5]: javax/xml/bind/DatatypeConverter, shutting down JVM since ‘akka.jvm-exit-on-fatal-error’ is enabled for ActorSystem[application]
java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
at io.jsonwebtoken.impl.Base64Codec.decode(Base64Codec.java:26)
at io.jsonwebtoken.impl.DefaultJwtParser.setSigningKey(DefaultJwtParser.java:151)
at play.api.mvc.JWTCookieDataCodec$JWTFormatter.parse(Cookie.scala:677)
at play.api.mvc.JWTCookieDataCodec.decode(Cookie.scala:592)
at play.api.mvc.JWTCookieDataCodec.decode$(Cookie.scala:584)
at play.api.mvc.DefaultJWTCookieDataCodec.decode(Cookie.scala:769)
at play.api.mvc.FallbackCookieDataCodec.decode(Cookie.scala:755)
at play.api.mvc.FallbackCookieDataCodec.decode$(Cookie.scala:746)
at play.api.mvc.DefaultSessionCookieBaker.decode(Session.scala:95)
at play.api.mvc.CookieBaker.decodeFromCookie(Cookie.scala:432)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
at io.jsonwebtoken.impl.Base64Codec.decode(Base64Codec.java:26)
at io.jsonwebtoken.impl.DefaultJwtParser.setSigningKey(DefaultJwtParser.java:151)
at play.api.mvc.JWTCookieDataCodec$JWTFormatter.parse(Cookie.scala:677)

Actually the problem is jaxb-api.
It’s easy to fix either in your code or inside the framework.

Play might backport the fix to 2.6: https://github.com/playframework/playframework/pull/8451

However for your own code you can just add: "javax.xml.bind" % "jaxb-api" % "2.3.0" to your libraryDependencies.

1 Like

@Kubendra The above PR was merged, so adding the extra dependency will no longer be required in 2.6.16.

2 Likes

And by the way, most of our sample projects are already building using Java 9 and Java 10:

  1. https://travis-ci.org/playframework/play-java-starter-example
  2. https://travis-ci.org/playframework/play-scala-starter-example

They don’t have the jaxb dependency, but instead there is a --add-module parameter added.

Best.