0

I have a project named cheshire-cat in which I am trying to run Rhino-based ClojureScript REPL with the command lein trampoline cljsbuild repl-rhino. It gives an exception in thread "main" and terminates.
What is the problem? Following is the terminal output:

$lein trampoline cljsbuild repl-rhino  
Running Rhino-based ClojureScript REPL.
Exception in thread "main" Syntax error compiling at (cljs/repl.clj:1:1).
    at clojure.lang.Compiler.load(Compiler.java:7647)
    at clojure.lang.RT.loadResourceScript(RT.java:381)
    at clojure.lang.RT.loadResourceScript(RT.java:372)
    at clojure.lang.RT.load(RT.java:463)
    at clojure.lang.RT.load(RT.java:428)
    at clojure.core$load$fn__6824.invoke(core.clj:6126)
    at clojure.core$load.invokeStatic(core.clj:6125)
    at clojure.core$load.doInvoke(core.clj:6109)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invokeStatic(core.clj:5908)
    at clojure.core$load_one.invoke(core.clj:5903)
    at clojure.core$load_lib$fn__6765.invoke(core.clj:5948)
    at clojure.core$load_lib.invokeStatic(core.clj:5947)
    at clojure.core$load_lib.doInvoke(core.clj:5928)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$load_libs.invokeStatic(core.clj:5985)
    at clojure.core$load_libs.doInvoke(core.clj:5969)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$require.invokeStatic(core.clj:6007)
    at clojure.core$require.doInvoke(core.clj:6007)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at cljsbuild.repl.rhino$eval144$loading__6706__auto____145.invoke(rhino.clj:1)
    at cljsbuild.repl.rhino$eval144.invokeStatic(rhino.clj:1)
    at cljsbuild.repl.rhino$eval144.invoke(rhino.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:7176)
    at clojure.lang.Compiler.eval(Compiler.java:7165)
    at clojure.lang.Compiler.load(Compiler.java:7635)
    at clojure.lang.RT.loadResourceScript(RT.java:381)
    at clojure.lang.RT.loadResourceScript(RT.java:372)
    at clojure.lang.RT.load(RT.java:463)
    at clojure.lang.RT.load(RT.java:428)
    at clojure.core$load$fn__6824.invoke(core.clj:6126)
    at clojure.core$load.invokeStatic(core.clj:6125)
    at clojure.core$load.doInvoke(core.clj:6109)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invokeStatic(core.clj:5908)
    at clojure.core$load_one.invoke(core.clj:5903)
    at clojure.core$load_lib$fn__6765.invoke(core.clj:5948)
    at clojure.core$load_lib.invokeStatic(core.clj:5947)
    at clojure.core$load_lib.doInvoke(core.clj:5928)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$load_libs.invokeStatic(core.clj:5985)
    at clojure.core$load_libs.doInvoke(core.clj:5969)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$require.invokeStatic(core.clj:6007)
    at clojure.core$require.doInvoke(core.clj:6007)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at user$eval5.invokeStatic(form-init5565266544074168037.clj:1)
    at user$eval5.invoke(form-init5565266544074168037.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:7176)
    at clojure.lang.Compiler.eval(Compiler.java:7165)
    at clojure.lang.Compiler.load(Compiler.java:7635)
    at clojure.lang.Compiler.loadFile(Compiler.java:7573)
    at clojure.main$load_script.invokeStatic(main.clj:452)
    at clojure.main$init_opt.invokeStatic(main.clj:454)
    at clojure.main$init_opt.invoke(main.clj:454)
    at clojure.main$initialize.invokeStatic(main.clj:485)
    at clojure.main$null_opt.invokeStatic(main.clj:519)
    at clojure.main$null_opt.invoke(main.clj:516)
    at clojure.main$main.invokeStatic(main.clj:598)
    at clojure.main$main.doInvoke(main.clj:561)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.lang.Var.applyTo(Var.java:705)
    at clojure.main.main(main.java:37)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
    at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:69)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
    at clojure.lang.DynamicClassLoader.loadClass(DynamicClassLoader.java:77)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:495)
    at java.base/java.lang.Class.forName(Class.java:474)
    at clojure.lang.RT.classForName(RT.java:2207)
    at clojure.lang.RT.classForNameNonLoading(RT.java:2220)
    at cljs.repl$eval150$loading__6706__auto____151.invoke(repl.clj:9)
    at cljs.repl$eval150.invokeStatic(repl.clj:9)
    at cljs.repl$eval150.invoke(repl.clj:9)
    at clojure.lang.Compiler.eval(Compiler.java:7176)
    at clojure.lang.Compiler.eval(Compiler.java:7165)
    at clojure.lang.Compiler.load(Compiler.java:7635)
    ... 67 more

This is my project.clj file:

(defproject cheshire-cat "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :min-lein-version "2.0.0"
  :dependencies [[org.clojure/clojure "1.10.0"]
                 [compojure "1.6.1"]
                 [ring/ring-defaults "0.3.2"]
                 [ring/ring-json "0.5.1"]
                 [org.clojure/clojurescript "0.0-2371"]] 
  :plugins [[lein-ring "0.12.6"]
            [lein-cljsbuild "1.1.8"]]
  :ring {:handler cheshire-cat.handler/app}
  :profiles
  {:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
                        [ring/ring-mock "0.3.2"]]}}
  :cljsbuild {
    :builds [{
        :source-paths ["src-cljs"]
        :compiler {
          :output-to "resources/public/main.js"
          :optimizations :whitespace
          :pretty-print true}}]})

I tried to change the dependencies version to make it work but it didn't. How to remove this error and make the command run the REPL without any error. Thanks.

leydovordu
  • 15
  • 3

2 Answers2

1

This is an issue with using newer JDKs (9+) with older software that used some packages only available until JDK8. You can fix this by adding

[javax.xml.bind/jaxb-api "2.3.1"]

to your :dependencies in project.clj.

Thomas Heller
  • 3,842
  • 1
  • 9
  • 9
  • It is giving another error: https://pastebin.com/HXUQip7f – leydovordu Nov 16 '22 at 07:48
  • What is this `project.clj` you are starting with? The ClojureScript version `"0.0-2371"` is something like 10 years old. Also many of the other versions are severly outdated? You should really consider starting with a more modern starting point? The Rhino REPL is also very likely to not work anymore? Maybe consider more modern things like shadow-cljs or figwheel-main? – Thomas Heller Nov 16 '22 at 07:57
  • I am reading "Living Clojure" book and in it, the author says to stick with ClojureScript version ```"0.0-2371"``` to follow up the demo. Still, I tried the latest version ```"1.11.60"``` and it ended up with error - https://pastebin.com/5NPwAAR1. How to make Rhino REPL work? – leydovordu Nov 16 '22 at 08:04
  • Unfortunately that book seems to be rather outdated. The Rhino REPL had been deprecated for many years, and removed entirely a while ago. So, if you must use it stick with the really old version. The other error you were seeing is probably due to a newer Clojure Version, maybe downgrade `org.clojure/clojure` to the version used in the book? – Thomas Heller Nov 16 '22 at 08:53
  • It worked. But now I'm getting another error: on executing command ```lein cljsbuild auto``` in another terminal window, it gives ```java.lang.IllegalAccessException``` error. See pastebin: https://pastebin.com/yQc8rgNr – leydovordu Nov 16 '22 at 09:21
  • That again is a JDK issue. If you must follow such outdated examples downgrade your Java version on your System to Java/JDK 8. Then you can follow the book without any adjustments. – Thomas Heller Nov 16 '22 at 09:25
0

It's not about dependencies, it's about the JDK version: https://stackoverflow.com/a/43574427/564509

And there's already an issue for that: https://github.com/emezeske/lein-cljsbuild/issues/499

Eugene Pakhomov
  • 9,309
  • 3
  • 27
  • 53