JonyEpsilon / lein-gorilla

A leiningen plugin for the Gorilla REPL
MIT License
34 stars 22 forks source link

Gorilla and Java 10 #13

Open peter-lyons-kehl opened 6 years ago

peter-lyons-kehl commented 6 years ago

Dear Jony,

Thank you for Gorilla.

Sadly, SUN/Oracle's Java 10 doesn't like it. From below it sounds not Gorilla-specific, but this seems to be the place to report.

# SUN's java version "10.0.1" 2018-04-17 on 64bit SUSE
# The problem probably also exists with OpenJDK 10. However, OpenJDK has more issues (it can't run lein at all).
lein new app playground
cd playground
# edit project.clj to add :plugins [[lein-gorilla "0.4.0"]] and :jvm-opts ["--add-modules" "java.xml.bind"]. See below for why :jvm-opts. After editing, project.clj is:
(defproject playground "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]]
  :main ^:skip-aot playground.core
  :target-path "target/%s"
    :plugins [[lein-gorilla "0.4.0"]]
    :jvm-opts ["--add-modules" "java.xml.bind"]
  :profiles {:uberjar {:aot :all}})

# To double-check, this should be an alternative to the above Ljvm-opts, but it didn't help either:
export  JAVA_TOOL_OPTIONS="-Djdk.launcher.addmods=java.xml.bind"

#Gorilla fails:
lein gorilla
Picked up JAVA_TOOL_OPTIONS: -Djdk.launcher.addmods=java.xml.bind
clojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter, compiling:(org/httpkit/server.clj:1:1)
 at clojure.lang.Compiler.load (Compiler.java:7391)
    clojure.lang.RT.loadResourceScript (RT.java:372)
...

Related, applied above but it didn't fix this for Java 10: https://github.com/bhauman/lein-figwheel/issues/612. The class should exist in Java 10: https://docs.oracle.com/javase/10/docs/api/javax/xml/bind/DatatypeConverter.html.

Please help.

peter-lyons-kehl commented 6 years ago

As explained at https://stackoverflow.com/questions/51466464/clojure-gorilla-repl-and-jvm-10-exception, :jvm-opts and dependencies don't apply to plugins. What helped was

:plugins [[javax.xml.bind/jaxb-api "2.3.0"]
         [lein-gorilla "0.4.0"]])

The above is most likely also covered by https://github.com/JonyEpsilon/lein-gorilla/pull/12.

However, that switched the problem to the same as with OpenJDK 10: ClassNotFoundException: sun.misc.Launcher. (Related: https://github.com/technomancy/leiningen/issues/2149 but it doesn't give any advice.)

ksseono commented 4 years ago

@peter-kehl You might want to try with this: https://github.com/benfb/lein-gorilla/releases/tag/v0.7.0