cognitect-labs / vase

Data driven microservices
Eclipse Public License 1.0
373 stars 42 forks source link

Template needs some changes to work with Java 9 and later #101

Closed mtnygard closed 5 years ago

mtnygard commented 5 years ago

Description

project.clj as generated by the template does not address modules introduced by Java 9. As a result, developers working with Java 9 through 10 will get java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter.

Expected Behavior

lein new vase my-app should result in a ready-to-run project.

Actual Behavior

lein new vase my-app followed by lein run-dev results in a stack trace like this:

Exception in thread "main" java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter, compiling:(com/cognitect/vase/util.clj:1:1)
        at clojure.lang.Compiler.load(Compiler.java:7442)
        at clojure.lang.RT.loadResourceScript(RT.java:374)
        at clojure.lang.RT.loadResourceScript(RT.java:365)
        at clojure.lang.RT.load(RT.java:455)
        at clojure.lang.RT.load(RT.java:421)
        at clojure.core$load$fn__7846.invoke(core.clj:6008)
        at clojure.core$load.invokeStatic(core.clj:6007)
        at clojure.core$load.doInvoke(core.clj:5991)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invokeStatic(core.clj:5812)
        ...

Steps to reproduce

lein new vase my-app

lein run-dev

Environment

Operating System (including version).

Any

Your current Leiningen/Boot/Maven version (lein --version)

Leiningen 2.8.1 on Java 10.0.2 OpenJDK 64-Bit Server VM

Pedestal and Vase version

Any.

JDK Version

My JDK:

openjdk full version "10.0.2+13-Ubuntu-1ubuntu0.18.04.4"

Note however, this will occur on any JDK post Java 9.

mtnygard commented 5 years ago

Something like the following in the generated project.clj would alleviate this issue:

:jvm-opts  ~(let [version    (System/getProperty "java.version")
                 [major _ _] (clojure.string/split version #"\.")]
                    (if (<= 9 (java.lang.Integer/parseInt major) 10)
                      ["--add-modules" "java.xml.bind"]
                      []))
ddeaguiar commented 5 years ago

@mtnygard This should now be resolved by this commit on master. No need to include a module.