Scala incompatibility with Java 9 - java.lang.NoClassDefFoundError

Just run the Scala SBT sample project after installing Java 9 on my computer, and I took advantage of this exception. I already tried some solutions that I found, but nothing.

Is there any incompatibility between Java 9 and Scala?

Scala Version: 2.12.3

Java version: java version "9"

IDE: IntelliJ

Thanks in advance.

info] Compiling 7 Scala sources and 1 Java source to /Users/ermis/Projects/begining-scala/target/scala-2.12/classes... [info] pahEnabledFilters - Enabled Filters (see <https://www.playframework.com/documentation/latest/Filters>): play.filters.csrf.CSRFFilter play.filters.headers.SecurityHeadersFilter play.filters.hosts.AllowedHostsFilter [info] play.api.Play - Application started (Dev) Uncaught error from thread [play-dev-mode-akka.actor.default- dispatcher-2]: javax/xml/bind/DatatypeConverter, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for for ActorSystem[play-dev-mode] java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter at io.jsonwebtoken.impl.Base64Codec.decode(Base64Codec.java:26) at io.jsonwebtoken.impl.DefaultJwtBuilder.signWith(DefaultJwtBuilder.java:106) at play.api.mvc.JWTCookieDataCodec$JWTFormatter.format(Cookie.scala:710) at play.api.mvc.JWTCookieDataCodec.encode(Cookie.scala:569) at play.api.mvc.JWTCookieDataCodec.encode$(Cookie.scala:567) at play.api.mvc.DefaultJWTCookieDataCodec.encode(Cookie.scala:760) at play.api.mvc.FallbackCookieDataCodec.encode(Cookie.scala:734) at play.api.mvc.FallbackCookieDataCodec.encode$(Cookie.scala:733) at play.api.mvc.DefaultSessionCookieBaker.encode(Session.scala:95) at play.api.mvc.CookieBaker.encodeAsCookie(Cookie.scala:414) at play.api.mvc.CookieBaker.encodeAsCookie$(Cookie.scala:413) at play.api.mvc.DefaultSessionCookieBaker.encodeAsCookie(Session.scala:95) at play.api.mvc.Result.$anonfun$bakeCookies$2(Results.scala:281) at scala.Option.map(Option.scala:146) at play.api.mvc.Result.bakeCookies(Results.scala:280) at play.core.server.common.ServerResultUtils.prepareCookies(ServerResultUtils.scala:227) at play.core.server.AkkaHttpServer.$anonfun$executeAction$3(AkkaHttpServer.scala:302) at akka.http.scaladsl.util.FastFuture$.strictTransform$1(FastFuture.scala:41) at akka.http.scaladsl.util.FastFuture$.transformWith$extension1(FastFuture.scala:55) at akka.http.scaladsl.util.FastFuture$.flatMap$extension(FastFuture.scala:26) at play.core.server.AkkaHttpServer.executeAction(AkkaHttpServer.scala:301) at play.core.server.AkkaHttpServer.executeHandler(AkkaHttpServer.scala:254) 

I tried this but did not work.

- add modules java.xml.bind or --add-modules java.se.ee enter image description here

+5
source share
2 answers

Try adding a compiler option to temporarily fix this:

 --add-modules java.se.ee 

since the module is common to Java EE, it will not be enabled by default in JDK9.

You can also track the issue up to JDK 9 support in the scala -dev repository for updates.

+4
source

I just uninstall Java 9 until someone gives me some lights and the compiler works as usual.

0
source

Source: https://habr.com/ru/post/1272266/


All Articles