Tutorial1 - Class not found Exception
colonelrascals opened this issue · comments
exception below
$ - boot cljs target
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by dynapath.defaults$fn__1516$fn__1517 (file:/Users/user/.m2/repository/boot/pod/2.7.2/pod-2.7.2.jar) to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of dynapath.defaults$fn__1516$fn__1517
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Writing main.cljs.edn...
Compiling ClojureScript...
• main.js
java.lang.Thread.run Thread.java: 844
java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java: 635
java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java: 1135
java.util.concurrent.FutureTask.run FutureTask.java: 264
...
clojure.core/binding-conveyor-fn/fn core.clj: 1938
adzerk.boot-cljs/compile-1/fn boot_cljs.clj: 126
adzerk.boot-cljs/compile boot_cljs.clj: 66
boot.pod/call-in* pod.clj: 413
...
jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke DelegatingMethodAccessorImpl.java: 43
jdk.internal.reflect.NativeMethodAccessorImpl.invoke NativeMethodAccessorImpl.java: 62
jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 NativeMethodAccessorImpl.java
org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke ClojureRuntimeShimImpl.java: 102
org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke ClojureRuntimeShimImpl.java: 109
...
boot.pod/call-in* pod.clj: 410
boot.pod/eval-fn-call pod.clj: 357
...
clojure.core/require core.clj: 5796 (repeats 2 times)
clojure.core/apply core.clj: 648
...
clojure.core/load-libs core.clj: 5758
clojure.core/load-libs core.clj: 5774
clojure.core/apply core.clj: 648
...
clojure.core/load-lib core.clj: 5717
clojure.core/load-lib core.clj: 5736
clojure.core/load-lib/fn core.clj: 5737
clojure.core/load-one core.clj: 5697
...
clojure.core/load core.clj: 5876
clojure.core/load core.clj: 5892
clojure.core/load/fn core.clj: 5893
...
adzerk.boot-cljs.impl/eval23 impl.clj: 1
adzerk.boot-cljs.impl/eval23/loading--auto-- impl.clj: 1
...
clojure.core/require core.clj: 5796 (repeats 2 times)
clojure.core/apply core.clj: 648
...
clojure.core/load-libs core.clj: 5758
clojure.core/load-libs core.clj: 5774
clojure.core/apply core.clj: 648
...
clojure.core/load-lib core.clj: 5717
clojure.core/load-lib core.clj: 5736
clojure.core/load-lib/fn core.clj: 5737
clojure.core/load-one core.clj: 5697
...
clojure.core/load core.clj: 5876
clojure.core/load core.clj: 5892
clojure.core/load/fn core.clj: 5893
...
cljs.build.api/eval2173 api.clj: 8
cljs.build.api/eval2173/loading--auto-- api.clj: 8
...
clojure.core/require core.clj: 5796 (repeats 2 times)
clojure.core/apply core.clj: 648
...
clojure.core/load-libs core.clj: 5758
clojure.core/load-libs core.clj: 5774
clojure.core/apply core.clj: 648
...
clojure.core/load-lib core.clj: 5717
clojure.core/load-lib core.clj: 5736
clojure.core/load-lib/fn core.clj: 5737
clojure.core/load-one core.clj: 5697
...
clojure.core/load core.clj: 5876
clojure.core/load core.clj: 5892
clojure.core/load/fn core.clj: 5893
...
cljs.closure/eval3402 closure.clj: 9
cljs.closure/eval3402/loading--auto-- closure.clj: 9
...
java.lang.Class.forName Class.java: 374
java.lang.Class.forName0 Class.java
java.lang.ClassLoader.loadClass ClassLoader.java: 499
...
java.lang.ClassLoader.loadClass ClassLoader.java: 566
...
java.net.URLClassLoader.findClass URLClassLoader.java: 466
java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
clojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter, compiling:(cljs/closure.clj:1:1)
clojure.lang.ExceptionInfo: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter, compiling:(cljs/closure.clj:1:1)
line: 11
Are you using JDK 9? It's an error specific to JDK 9 as I can see from the stacktrace. It should work on JDK8. Can you add the info regarding java -version
?
You can try adding the jvm opts to resolve this in JDK 9 if you cannot switch to JDK 8. Refer : http-kit/http-kit#356 (comment) and https://www.deps.co/blog/how-to-upgrade-clojure-projects-to-use-java-9/
java -version
java version "10" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+46)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode)
Thanks. You can try switching to JDK 8 for now or add the jvm-opts as mentioned. I am still not sure about the dependency that causes this error.
I can fix this problem with adding environment variable, BOOT_JVM_OPTIONS="--add-modules=java.xml.bind"
but adding that to .boot/boot.properties doesn't work
I fixed this by adding [org.clojure/clojurescript "1.10.238"]
before [adzerk/boot-cljs "2.1.4"]
.
So I went from:
(set-env!
:source-paths #{"src/cljs"}
:resource-paths #{"html"}
:dependencies '[[adzerk/boot-cljs "2.1.4"]])
(require '[adzerk.boot-cljs :refer [cljs]])
to:
(set-env!
:source-paths #{"src/cljs"}
:resource-paths #{"html"}
:dependencies '[[org.clojure/clojurescript "1.10.238"]
[adzerk/boot-cljs "2.1.4"]])
(require '[adzerk.boot-cljs :refer [cljs]])
I also tried your suggestion nouse and couldn't fix it by adding that line to boot.properties.
Whoah, nice. Still had to do this but now it's working.
Just to confirm that the suggested solution to change dependencies to
:dependencies '[[org.clojure/clojurescript "1.10.238"]
[adzerk/boot-cljs "2.1.4"]])
works for java 11 as well
Just for clarification, is the solution to use a newer version of cljs?
looks like it
To fix (this and future tutorial issues) I updated dependencies to include http-kit, cider/piggieback,nrepl and other dependency versions.
:dependencies '[[http-kit "2.3.0"]
[org.clojure/clojure "1.10.0"]
[org.clojure/clojurescript "1.10.238"]
[adzerk/boot-cljs "2.1.5"]
[pandeiro/boot-http "0.8.3"]
[org.clojure/tools.nrepl "0.2.12"] ;;required in order to make boot-http works
[adzerk/boot-reload "0.6.0"]
[adzerk/boot-cljs-repl "0.4.0"]
[com.cemerick/piggieback "0.2.2"]
[weasel "0.7.0"]
[cider/piggieback "0.3.9" :scope "test"]
[nrepl "0.4.5" :scope "test"]])
Also note one needs to update boot.properties like below:
#Wed Feb 22 16:15:15 CET 2017
BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_CLOJURE_VERSION=1.10.0
BOOT_VERSION=2.8.2