clojure-java-9
clojure-java-9 copied to clipboard
ClassNotFoundException: javax.xml.bind.*
The java.xml.bind package is deprecated in Java 9 and not included in the default classpath. Code which tries to use classes under java.xml.bind.* will throw ClassNotFoundException. For example, from clavatar:
java.lang.ClassNotFoundException: javax.xml.bind.annotation.adapters.HexBinaryAdapter
The fix, as described in How to upgrade your Clojure projects to use Java 9, is to add the JVM option --add-modules "java.xml.bind". In a Leiningen project.clj file, this is:
:jvm-opts ["--add-modules" "java.xml.bind"]
Libraries affected by this:
- clavatar (Gravatar URL generator)
ClojureScript used to import that package, fixed as of https://github.com/clojure/clojurescript/commit/544c1b77d76d48f234cdb03746ea993158c46aff