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.
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.
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
I am trying to connect to Repl in Clojure project in Light Table. I went to connections, chose project.clj I wanted to connect to but unfortunately without success. I created project with "lein new app my-app". Before this, I had tried to connect with some another project that I had created with Luminus template and it was successfully. But when I made this simple app with "lein new app my-app" I cant connect. I got the following error:
We couldn't connect.
Looks like there was an issue trying to connect to the project. Here's what we got:
final project: {:description FIXME: write description, :compile-path C:\Users\nenad\Desktop\my-first-neural-network\target\base+system+user+dev+8ddc75d4\classes, :deploy-repositories [[clojars {:url https://clojars.org/repo/, :password :gpg, :username :gpg}]], :group my-first-neural-network, :license {:name EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0, :url https://www.eclipse.org/legal/epl-2.0/}, :java-cmd C:\Program Files\Java\jdk1.8.0_201\bin\java.exe, :resource-paths (C:\Users\nenad\Desktop\my-first-neural-network\dev-resources C:\Users\nenad\Desktop\my-first-neural-network\resources), :uberjar-merge-with {META-INF/plexus/components.xml leiningen.uberjar/components-merger, data_readers.clj leiningen.uberjar/clj-map-merger, #"META-INF/services/.*" [clojure.core/slurp (fn* [p1__953__955__auto__ p2__954__956__auto__] (clojure.core/str p1__953__955__auto__
p2__954__956__auto__)) clojure.core/spit]}, :name my-first-neural-network, :checkout-deps-shares [:source-paths :test-paths :resource-paths :compile-path #'leiningen.core.classpath/checkout-deps-paths], :source-paths (C:\Users\nenad\Desktop\my-first-neural-network\src), :eval-in :subprocess, :repositories [[central {:url https://repo1.maven.org/maven2/, :snapshots false}] [clojars {:url https://clojars.org/repo/}]], :test-paths (C:\Users\nenad\Desktop\my-first-neural-network\test), :target-path C:\Users\nenad\Desktop\my-first-neural-network\target\base+system+user+dev+8ddc75d4, :prep-tasks [javac compile], :native-path C:\Users\nenad\Desktop\my-first-neural-network\target\base+system+user+dev+8ddc75d4\native, :offline? false, :root C:\Users\nenad\Desktop\my-first-neural-network, :pedantic? ranges, :clean-targets [:target-path], :plugins [], :url http://example.com/FIXME, :profiles {:uberjar {:aot [:all], :jvm-opts nil, :eval-in nil}}, :plugin-repositories [[central {:url https://repo1.maven.org/maven2/, :snapshots false}] [clojars {:url https://clojars.org/repo/}]], :version 0.1.0-SNAPSHOT, :jar-exclusions [#"^\."], :main my-first-neural-network.core, :global-vars {}, :uberjar-exclusions [#"(?i)^META-INF/[^/]*\.(SF|RSA|DSA)$"], :jvm-opts [], :dependencies ([org.clojure/clojure 1.10.0] [org.clojure/tools.nrepl 0.2.10 :exclusions ([org.clojure/clojure])] [clojure-complete/clojure-complete 0.2.3 :exclusions ([org.clojure/clojure])] [lein-light-nrepl/lein-light-nrepl 0.3.3] [lein-light-nrepl-instarepl/lein-light-nrepl-instarepl 0.3.1]), :release-tasks [[vcs assert-committed] [change version leiningen.release/bump-version release] [vcs commit] [vcs tag] [deploy] [change version leiningen.release/bump-version] [vcs commit] [vcs push]], :repl-options {:nrepl-middleware [lighttable.nrepl.handler/lighttable-ops], :init (clojure.core/swap! lighttable.nrepl.core/my-settings clojure.core/merge {:name my-first-neural-network 0.1.0-SNAPSHOT, :project (quote {:description FIXME: write description, :compile-path C:\Users\nenad\Desktop\my-first-neural-network\target\base+system+user+dev\classes, :deploy-repositories [[clojars {:url https://clojars.org/repo/, :password :gpg, :username :gpg}]], :group my-first-neural-network, :license {:name EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0, :url https://www.eclipse.org/legal/epl-2.0/}, :java-cmd C:\Program Files\Java\jdk1.8.0_201\bin\java.exe, :resource-paths (C:\Users\nenad\Desktop\my-first-neural-network\dev-resources C:\Users\nenad\Desktop\my-first-neural-network\resources), :uberjar-merge-with {META-INF/plexus/components.xml leiningen.uberjar/components-merger, data_readers.clj leiningen.uberjar/clj-map-merger, #"META-INF/services/.*" [clojure.core/slurp (fn* [p1__953__955__auto__ p2__954__956__auto__] (clojure.core/str p1__953__955__auto__
p2__954__956__auto__)) clojure.core/spit]}, :name my-first-neural-network, :checkout-deps-shares [:source-paths :test-paths :resource-paths :compile-path #'leiningen.core.classpath/checkout-deps-paths], :source-paths (C:\Users\nenad\Desktop\my-first-neural-network\src), :eval-in :subprocess, :repositories [[central {:url https://repo1.maven.org/maven2/, :snapshots false}] [clojars {:url https://clojars.org/repo/}]], :test-paths (C:\Users\nenad\Desktop\my-first-neural-network\test), :target-path C:\Users\nenad\Desktop\my-first-neural-network\target\base+system+user+dev, :prep-tasks [javac compile], :native-path C:\Users\nenad\Desktop\my-first-neural-network\target\base+system+user+dev\native, :offline? false, :root C:\Users\nenad\Desktop\my-first-neural-network, :pedantic? ranges, :clean-targets [:target-path], :plugins [], :url http://example.com/FIXME, :profiles {:uberjar {:aot [:all], :jvm-opts nil, :eval-in nil}}, :plugin-repositories [[central {:url https://repo1.maven.org/maven2/, :snapshots false}] [clojars {:url https://clojars.org/repo/}]], :version 0.1.0-SNAPSHOT, :jar-exclusions [#"^\."], :main my-first-neural-network.core, :global-vars {}, :uberjar-exclusions [#"(?i)^META-INF/[^/]*\.(SF|RSA|DSA)$"], :jvm-opts [], :dependencies ([org.clojure/clojure 1.10.0] [org.clojure/tools.nrepl 0.2.10 :exclusions ([org.clojure/clojure])] [clojure-complete/clojure-complete 0.2.3 :exclusions ([org.clojure/clojure])]), :release-tasks [[vcs assert-committed] [change version leiningen.release/bump-version release] [vcs commit] [vcs tag] [deploy] [change version leiningen.release/bump-version] [vcs commit] [vcs push]], :test-selectors {:default (constantly true)}})})}, :test-selectors {:default (constantly true)}}
Error loading lighttable.nrepl.handler: Syntax error macroexpanding clojure.core/ns at (cljs/source_map/base64_vlq.clj:1:1).
Exception in thread "main" Syntax error compiling var at (C:\Users\nenad\AppData\Local\Temp\form-init2299474071958135132.clj:1:5184).
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7114)
at clojure.lang.Compiler.analyze(Compiler.java:6789)
at clojure.lang.Compiler.analyze(Compiler.java:6745)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3888)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7108)
at clojure.lang.Compiler.analyze(Compiler.java:6789)
at clojure.lang.Compiler.analyze(Compiler.java:6745)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3888)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7108)
at clojure.lang.Compiler.analyze(Compiler.java:6789)
at clojure.lang.Compiler.access$300(Compiler.java:38)
at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6384)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7106)
at clojure.lang.Compiler.analyze(Compiler.java:6789)
at clojure.lang.Compiler.analyze(Compiler.java:6745)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:6120)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5467)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:4029)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7104)
at clojure.lang.Compiler.analyze(Compiler.java:6789)
at clojure.lang.Compiler.eval(Compiler.java:7173)
at clojure.lang.Compiler.eval(Compiler.java:7166)
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.RuntimeException: Unable to resolve var: lighttable.nrepl.handler/lighttable-ops in this context
at clojure.lang.Util.runtimeException(Util.java:221)
at clojure.lang.Compiler$TheVarExpr$Parser.parse(Compiler.java:720)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7106)
... 34 more
clojure.lang.ExceptionInfo: Subprocess failed {:exit-code 1}
at clojure.core$ex_info.invoke(core.clj:4593)
at leiningen.core.eval$fn__2432.invoke(eval.clj:236)
at clojure.lang.MultiFn.invoke(MultiFn.java:233)
at leiningen.core.eval$eval_in_project.invoke(eval.clj:337)
at clojure.lang.AFn.applyToHelper(AFn.java:160)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invoke(core.clj:632)
at leiningen.repl$repl.doInvoke(repl.clj:322)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at leiningen.light_nrepl$light.invoke(light_nrepl.clj:77)
at leiningen.light_nrepl$_main.doInvoke(light_nrepl.clj:85)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at leiningen.light_nrepl.main(Unknown Source)
close
I changed Clojure version in project.clj file in root of the project but now I cant start REPL. I got the follwing error:
Starting nREPL server...
"C:\Program Files\Java\jdk-11.0.2\bin\java.exe" -Dfile.encoding=Cp1252 -Dconf=dev-config.edn -Dclojure.compile.path=C:\Users\nenad\Desktop\Vezba\myapp\target\default\classes -Dmyapp.version=0.1.0-SNAPSHOT -Dclojure.debug=false "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3.5\lib\idea_rt.jar=49713:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3.5\bin" -classpath C:\Users\nenad\Desktop\Vezba\myapp\test\clj;C:\Users\nenad\Desktop\Vezba\myapp\env\dev\clj;C:\Users\nenad\Desktop\Vezba\myapp\src\clj;C:\Users\nenad\Desktop\Vezba\myapp\env\dev\resources;C:\Users\nenad\Desktop\Vezba\myapp\dev-resources;C:\Users\nenad\Desktop\Vezba\myapp\resources;C:\Users\nenad\Desktop\Vezba\myapp\target\default\classes;C:\Users\nenad\.m2\repository\metosin\reitit-core\0.3.1\reitit-core-0.3.1.jar;C:\Users\nenad\.m2\repository\ring\ring-core\1.7.1\ring-core-1.7.1.jar;C:\Users\nenad\.m2\repository\funcool\cuerdas\2.0.5\cuerdas-2.0.5.jar;C:\Users\nenad\.m2\repository\clojure-complete\clojure-complete\0.2.5\clojure-complete-0.2.5.jar;C:\Users\nenad\.m2\repository\org\clojure\clojure\1.8.0\clojure-1.8.0.jar;C:\Users\nenad\.m2\repository\cprop\cprop\0.1.13\cprop-0.1.13.jar;C:\Users\nenad\.m2\repository\org\msgpack\msgpack\0.6.12\msgpack-0.6.12.jar;C:\Users\nenad\.m2\repository\org\webjars\webjars-locator\0.36\webjars-locator-0.36.jar;C:\Users\nenad\.m2\repository\expound\expound\0.7.2\expound-0.7.2.jar;C:\Users\nenad\.m2\repository\lambdaisland\deep-diff\0.0-25\deep-diff-0.0-25.jar;C:\Users\nenad\.m2\repository\tigris\tigris\0.1.1\tigris-0.1.1.jar;C:\Users\nenad\.m2\repository\mvxcvi\arrangement\1.1.1\arrangement-1.1.1.jar;C:\Users\nenad\.m2\repository\org\projectodd\wunderboss\wunderboss-web\0.13.1\wunderboss-web-0.13.1.jar;C:\Users\nenad\.m2\repository\metosin\reitit-dev\0.3.1\reitit-dev-0.3.1.jar;C:\Users\nenad\.m2\repository\ch\qos\logback\logback-classic\1.1.3\logback-classic-1.1.3.jar;C:\Users\nenad\.m2\repository\metosin\reitit-swagger\0.3.1\reitit-swagger-0.3.1.jar;C:\Users\nenad\.m2\repository\selmer\selmer\1.12.12\selmer-1.12.12.jar;C:\Users\nenad\.m2\repository\metosin\reitit-schema\0.3.1\reitit-schema-0.3.1.jar;C:\Users\nenad\.m2\repository\com\cognitect\transit-clj\0.8.313\transit-clj-0.8.313.jar;C:\Users\nenad\.m2\repository\org\projectodd\wunderboss\wunderboss-core\0.13.1\wunderboss-core-0.13.1.jar;C:\Users\nenad\.m2\repository\org\clojure\core.rrb-vector\0.0.13\core.rrb-vector-0.0.13.jar;C:\Users\nenad\.m2\repository\meta-merge\meta-merge\1.0.0\meta-merge-1.0.0.jar;C:\Users\nenad\.m2\repository\joda-time\joda-time\2.9.9\joda-time-2.9.9.jar;C:\Users\nenad\.m2\repository\ring\ring-headers\0.3.0\ring-headers-0.3.0.jar;C:\Users\nenad\.m2\repository\pjstadig\humane-test-output\0.9.0\humane-test-output-0.9.0.jar;C:\Users\nenad\.m2\repository\javax\xml\bind\jaxb-api\2.3.0\jaxb-api-2.3.0.jar;C:\Users\nenad\.m2\repository\org\apache\commons\commons-lang3\3.8.1\commons-lang3-3.8.1.jar;C:\Users\nenad\.m2\repository\mount\mount\0.1.16\mount-0.1.16.jar;C:\Users\nenad\.m2\repository\ring\ring-ssl\0.3.0\ring-ssl-0.3.0.jar;C:\Users\nenad\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.7\jackson-datatype-jsr310-2.9.7.jar;C:\Users\nenad\.m2\repository\org\projectodd\wunderboss\wunderboss-web-undertow\0.13.1\wunderboss-web-undertow-0.13.1.jar;C:\Users\nenad\.m2\repository\metosin\reitit\0.3.1\reitit-0.3.1.jar;C:\Users\nenad\.m2\repository\metosin\reitit-spec\0.3.1\reitit-spec-0.3.1.jar;C:\Users\nenad\.m2\repository\commons-fileupload\commons-fileupload\1.3.3\commons-fileupload-1.3.3.jar;C:\Users\nenad\.m2\repository\io\undertow\undertow-core\1.4.14.Final\undertow-core-1.4.14.Final.jar;C:\Users\nenad\.m2\repository\metosin\reitit-middleware\0.3.1\reitit-middleware-0.3.1.jar;C:\Users\nenad\.m2\repository\prone\prone\1.6.1\prone-1.6.1.jar;C:\Users\nenad\.m2\repository\metosin\jsonista\0.2.2\jsonista-0.2.2.jar;C:\Users\nenad\.m2\repository\org\jboss\spec\javax\servlet\jboss-servlet-api_3.1_spec\1.0.0.Final\jboss-servlet-api_3.1_spec-1.0.0.Final.jar;C:\Users\nenad\.m2\repository\net\jodah\expiringmap\0.5.8\expiringmap-0.5.8.jar;C:\Users\nenad\.m2\repository\org\immutant\web\2.1.10\web-2.1.10.jar;C:\Users\nenad\.m2\repository\ring\ring-mock\0.3.2\ring-mock-0.3.2.jar;C:\Users\nenad\.m2\repository\prismatic\schema\1.1.9\schema-1.1.9.jar;C:\Users\nenad\.m2\repository\metosin\spec-tools\0.9.0\spec-tools-0.9.0.jar;C:\Users\nenad\.m2\repository\org\webjars\npm\material-icons\0.3.0\material-icons-0.3.0.jar;C:\Users\nenad\.m2\repository\org\clojure\tools.reader\0.10.0\tools.reader-0.10.0.jar;C:\Users\nenad\.m2\repository\org\ow2\asm\asm\5.1\asm-5.1.jar;C:\Users\nenad\.m2\repository\ring\ring-codec\1.1.1\ring-codec-1.1.1.jar;C:\Users\nenad\.m2\repository\nrepl\nrepl\0.6.0\nrepl-0.6.0.jar;C:\Users\nenad\.m2\repository\org\jboss\spec\javax\websocket\jboss-websocket-api_1.1_spec\1.1.0.Final\jboss-websocket-api_1.1_spec-1.1.0.Final.jar;C:\Users\nenad\.m2\repository\io\undertow\undertow-websockets-jsr\1.4.14.Final\undertow-websockets-jsr-1.4.14.Final.jar;C:\Users\nenad\.m2\repository\ns-tracker\ns-tracker\0.3.1\ns-tracker-0.3.1.jar;C:\Users\nenad\.m2\repository\org\clojure\java.classpath\0.2.3\java.classpath-0.2.3.jar;C:\Users\nenad\.m2\repository\org\webjars\webjars-locator-jboss-vfs\0.1.0\webjars-locator-jboss-vfs-0.1.0.jar;C:\Users\nenad\.m2\repository\commons-io\commons-io\2.6\commons-io-2.6.jar;C:\Users\nenad\.m2\repository\metosin\reitit-ring\0.3.1\reitit-ring-0.3.1.jar;C:\Users\nenad\.m2\repository\crypto-equality\crypto-equality\1.0.0\crypto-equality-1.0.0.jar;C:\Users\nenad\.m2\repository\tech\droit\clj-diff\1.0.0\clj-diff-1.0.0.jar;C:\Users\nenad\.m2\repository\org\jboss\xnio\xnio-api\3.3.6.Final\xnio-api-3.3.6.Final.jar;C:\Users\nenad\.m2\repository\org\projectodd\wunderboss\wunderboss-clojure\0.13.1\wunderboss-clojure-0.13.1.jar;C:\Users\nenad\.m2\repository\luminus-transit\luminus-transit\0.1.1\luminus-transit-0.1.1.jar;C:\Users\nenad\.m2\repository\org\jboss\xnio\xnio-nio\3.3.6.Final\xnio-nio-3.3.6.Final.jar;C:\Users\nenad\.m2\repository\metosin\reitit-sieppari\0.3.1\reitit-sieppari-0.3.1.jar;C:\Users\nenad\.m2\repository\com\cognitect\transit-js\0.8.846\transit-js-0.8.846.jar;C:\Users\nenad\.m2\repository\org\webjars\npm\bulma\0.7.4\bulma-0.7.4.jar;C:\Users\nenad\.m2\repository\metosin\ring-swagger-ui\2.2.10\ring-swagger-ui-2.2.10.jar;C:\Users\nenad\.m2\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;C:\Users\nenad\.m2\repository\com\googlecode\json-simple\json-simple\1.1.1\json-simple-1.1.1.jar;C:\Users\nenad\.m2\repository\hiccup\hiccup\1.0.5\hiccup-1.0.5.jar;C:\Users\nenad\.m2\repository\org\webjars\webjars-locator-core\0.37\webjars-locator-core-0.37.jar;C:\Users\nenad\.m2\repository\clj-tuple\clj-tuple\0.2.2\clj-tuple-0.2.2.jar;C:\Users\nenad\.m2\repository\mvxcvi\puget\1.0.3\puget-1.0.3.jar;C:\Users\nenad\.m2\repository\clj-time\clj-time\0.14.3\clj-time-0.14.3.jar;C:\Users\nenad\.m2\repository\json-html\json-html\0.4.4\json-html-0.4.4.jar;C:\Users\nenad\.m2\repository\org\clojure\tools.logging\0.4.1\tools.logging-0.4.1.jar;C:\Users\nenad\.m2\repository\metosin\reitit-swagger-ui\0.3.1\reitit-swagger-ui-0.3.1.jar;C:\Users\nenad\.m2\repository\org\jboss\spec\javax\annotation\jboss-annotations-api_1.2_spec\1.0.0.Final\jboss-annotations-api_1.2_spec-1.0.0.Final.jar;C:\Users\nenad\.m2\repository\ring\ring-devel\1.7.1\ring-devel-1.7.1.jar;C:\Users\nenad\.m2\repository\luminus-immutant\luminus-immutant\0.2.5\luminus-immutant-0.2.5.jar;C:\Users\nenad\.m2\repository\org\clojure\tools.cli\0.4.2\tools.cli-0.4.2.jar;C:\Users\nenad\.m2\repository\org\clojure\tools.namespace\0.2.11\tools.namespace-0.2.11.jar;C:\Users\nenad\.m2\repository\metosin\ring-http-response\0.9.1\ring-http-response-0.9.1.jar;C:\Users\nenad\.m2\repository\potemkin\potemkin\0.4.5\potemkin-0.4.5.jar;C:\Users\nenad\.m2\repository\expiring-map\expiring-map\0.1.8\expiring-map-0.1.8.jar;C:\Users\nenad\.m2\repository\com\cognitect\transit-java\0.8.337\transit-java-0.8.337.jar;C:\Users\nenad\.m2\repository\metosin\reitit-interceptors\0.3.1\reitit-interceptors-0.3.1.jar;C:\Users\nenad\.m2\repository\org\slf4j\slf4j-api\1.7.7\slf4j-api-1.7.7.jar;C:\Users\nenad\.m2\repository\virgil\virgil\0.1.6\virgil-0.1.6.jar;C:\Users\nenad\.m2\repository\metosin\schema-tools\0.11.0\schema-tools-0.11.0.jar;C:\Users\nenad\.m2\repository\ring-webjars\ring-webjars\0.2.0\ring-webjars-0.2.0.jar;C:\Users\nenad\.m2\repository\luminus\ring-ttl-session\0.3.2\ring-ttl-session-0.3.2.jar;C:\Users\nenad\.m2\repository\metosin\muuntaja\0.6.4\muuntaja-0.6.4.jar;C:\Users\nenad\.m2\repository\crypto-random\crypto-random\1.2.0\crypto-random-1.2.0.jar;C:\Users\nenad\.m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar;C:\Users\nenad\.m2\repository\riddley\riddley\0.1.12\riddley-0.1.12.jar;C:\Users\nenad\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.8\jackson-databind-2.9.8.jar;C:\Users\nenad\.m2\repository\metosin\sieppari\0.0.0-alpha7\sieppari-0.0.0-alpha7.jar;C:\Users\nenad\.m2\repository\com\cognitect\transit-cljs\0.8.256\transit-cljs-0.8.256.jar;C:\Users\nenad\.m2\repository\fipp\fipp\0.6.17\fipp-0.6.17.jar;C:\Users\nenad\.m2\repository\markdown-clj\markdown-clj\1.0.7\markdown-clj-1.0.7.jar;C:\Users\nenad\.m2\repository\org\immutant\core\2.1.10\core-2.1.10.jar;C:\Users\nenad\.m2\repository\cheshire\cheshire\5.8.1\cheshire-5.8.1.jar;C:\Users\nenad\.m2\repository\io\undertow\undertow-servlet\1.4.14.Final\undertow-servlet-1.4.14.Final.jar;C:\Users\nenad\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.6\jackson-core-2.9.6.jar;C:\Users\nenad\.m2\repository\com\fasterxml\jackson\dataformat\jackson-dataformat-cbor\2.9.6\jackson-dataformat-cbor-2.9.6.jar;C:\Users\nenad\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;C:\Users\nenad\.m2\repository\metosin\reitit-frontend\0.3.1\reitit-frontend-0.3.1.jar;C:\Users\nenad\.m2\repository\ch\qos\logback\logback-core\1.1.3\logback-core-1.1.3.jar;C:\Users\nenad\.m2\repository\com\andrewmcveigh\cljs-time\0.5.2\cljs-time-0.5.2.jar;C:\Users\nenad\.m2\repository\org\jboss\logging\jboss-logging\3.2.1.Final\jboss-logging-3.2.1.Final.jar;C:\Users\nenad\.m2\repository\ring\ring-anti-forgery\1.3.0\ring-anti-forgery-1.3.0.jar;C:\Users\nenad\.m2\repository\realize\realize\1.1.0\realize-1.1.0.jar;C:\Users\nenad\.m2\repository\org\apache\commons\commons-compress\1.18\commons-compress-1.18.jar;C:\Users\nenad\.m2\repository\org\javassist\javassist\3.18.1-GA\javassist-3.18.1-GA.jar;C:\Users\nenad\.m2\repository\funcool\struct\1.3.0\struct-1.3.0.jar;C:\Users\nenad\.m2\repository\metosin\reitit-http\0.3.1\reitit-http-0.3.1.jar;C:\Users\nenad\.m2\repository\clojure\java-time\clojure.java-time\0.3.2\clojure.java-time-0.3.2.jar;C:\Users\nenad\.m2\repository\ring\ring-defaults\0.3.2\ring-defaults-0.3.2.jar;C:\Users\nenad\.m2\repository\org\clojure\spec.alpha\0.2.176\spec.alpha-0.2.176.jar;C:\Users\nenad\.m2\repository\com\fasterxml\jackson\dataformat\jackson-dataformat-smile\2.9.6\jackson-dataformat-smile-2.9.6.jar;C:\Users\nenad\.m2\repository\clj-stacktrace\clj-stacktrace\0.2.8\clj-stacktrace-0.2.8.jar clojure.main -i C:\Users\nenad\AppData\Local\Temp\form-init47301827214867056.clj
java.lang.ExceptionInInitializerError
at clojure.main.<clinit>(main.java:20)
Caused by: java.lang.ExceptionInInitializerError, compiling:(user.clj:1:1)
at clojure.lang.Compiler.load(Compiler.java:7391)
at clojure.lang.RT.loadResourceScript(RT.java:372)
at clojure.lang.RT.loadResourceScript(RT.java:359)
at clojure.lang.RT.maybeLoadResourceScript(RT.java:355)
at clojure.lang.RT.doInit(RT.java:475)
at clojure.lang.RT.<clinit>(RT.java:331)
... 1 more
Caused by: java.lang.ExceptionInInitializerError
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at clojure.lang.RT.classForName(RT.java:2168)
at clojure.lang.RT.classForName(RT.java:2177)
at clojure.lang.RT.loadClassForName(RT.java:2196)
at clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:419)
at clojure.core$load$fn__5677.invoke(core.clj:5893)
at clojure.core$load.invokeStatic(core.clj:5892)
at clojure.core$load.doInvoke(core.clj:5876)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invokeStatic(core.clj:5697)
at clojure.core$load_one.invoke(core.clj:5692)
at clojure.core$load_lib$fn__5626.invoke(core.clj:5737)
at clojure.core$load_lib.invokeStatic(core.clj:5736)
at clojure.core$load_lib.doInvoke(core.clj:5717)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invokeStatic(core.clj:648)
at clojure.core$load_libs.invokeStatic(core.clj:5774)
at clojure.core$load_libs.doInvoke(core.clj:5758)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:648)
at clojure.core$require.invokeStatic(core.clj:5796)
at clojure.core$require.doInvoke(core.clj:5796)
at clojure.lang.RestFn.invoke(RestFn.java:482)
at user$eval3$loading__5569__auto____4.invoke(user.clj:1)
at user$eval3.invokeStatic(user.clj:1)
at user$eval3.invoke(user.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6927)
at clojure.lang.Compiler.eval(Compiler.java:6916)
at clojure.lang.Compiler.load(Compiler.java:7379)
... 6 more
Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/ident?
at clojure.lang.Var$Unbound.throwArity(Var.java:43)
at clojure.lang.AFn.invoke(AFn.java:32)
at clojure.spec.alpha$spec_impl.invokeStatic(alpha.clj:915)
at clojure.spec.alpha$spec_impl.invoke(alpha.clj:908)
at clojure.spec.alpha__init.load(Unknown Source)
at clojure.spec.alpha__init.<clinit>(Unknown Source)
... 37 more
Exception in thread "main"
Process finished with exit code 1
Exception starting REPL: java.lang.InterruptedException
Hmmm. The problem here is, LT doesn't support a Clojure project running Clojure >1.8.0. Yes, LT needs to update to support new Clojure/Script versions. There are WIP patches to help make this possible. For now, sadly, you'll have to drop down to older releases of Clojure.
I am building a server program to provide an API to a mongo database containing details of photos. All works well running it from the REPL, or if I start it using lein run.
The problems happen when I try and run the uberjar. Building the uberjar works ok:
(master) photo-api: lein uberjar
Compiling photo-api.env
Compiling photo-api.config
Compiling photo-api.core
WARNING: find-keyword already refers to: #'clojure.core/find-keyword in namespace: image-lib.core, being replaced by: #'image-lib.core/find-keyword
Compiling photo-api.db.core
Compiling photo-api.handler
Compiling photo-api.layout
Compiling photo-api.middleware
Compiling photo-api.routes.home
Compiling photo-api.routes.services
Created /Users/iain/Code/Clojure/Luminus/photo-api/target/uberjar/photo-api-0.1.0-SNAPSHOT.jar
Created /Users/iain/Code/Clojure/Luminus/photo-api/target/uberjar/photo-api.jar
(master) photo-api:
but running the jar gives an error:
(master) photo-api: java -jar target/uberjar/photo-api.jar
WARNING: find-keyword already refers to: #'clojure.core/find-keyword in namespace: image-lib.core, being replaced by: #'image-lib.core/find-keyword
read config from resource: "config.edn"
Exception in thread "main" java.lang.RuntimeException: could not start [#'photo-api.db.core/db*] due to
at mount.core$up$fn__420.invoke(core.cljc:92)
at mount.core$up.invokeStatic(core.cljc:92)
at mount.core$up.invoke(core.cljc:90)
at mount.core$bring.invokeStatic(core.cljc:210)
at mount.core$bring.invoke(core.cljc:202)
at mount.core$start.invokeStatic(core.cljc:252)
at mount.core$start.doInvoke(core.cljc:244)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at mount.core$start_with_args.invokeStatic(core.cljc:350)
at mount.core$start_with_args.doInvoke(core.cljc:346)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at photo_api.core$start_app.invokeStatic(core.clj:42)
at photo_api.core$start_app.invoke(core.clj:41)
at photo_api.core$_main.invokeStatic(core.clj:50)
at photo_api.core$_main.doInvoke(core.clj:49)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at photo_api.core.main(Unknown Source)
Caused by: java.lang.NullPointerException
at com.mongodb.ConnectionString.<init>(ConnectionString.java:222)
at com.mongodb.MongoClientURI.<init>(MongoClientURI.java:189)
at com.mongodb.MongoClientURI.<init>(MongoClientURI.java:171)
at monger.core$connect_via_uri.invokeStatic(core.clj:230)
at monger.core$connect_via_uri.invoke(core.clj:230)
at photo_api.db.core$fn__12620.invokeStatic(core.clj:29)
at photo_api.db.core$fn__12620.invoke(core.clj:28)
at mount.core$record_BANG_.invokeStatic(core.cljc:86)
at mount.core$record_BANG_.invoke(core.cljc:85)
at mount.core$up$fn__420.invoke(core.cljc:93)
... 18 more
Or the SNAPSHOT jar.
(master) photo-api: java -jar target/uberjar/photo-api-0.1.0-SNAPSHOT.jar
Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/Var
at photo_api.core.<clinit>(Unknown Source)
Caused by: java.lang.ClassNotFoundException: clojure.lang.Var
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
(master) photo-api:
What am I missing here? I'm guessing it's something to do with dev build and production build differences, but I can't spot anything obvious and the error messages are not a lot of help to me.
This is the project file which as far as I remember is mostly straight from the original luminus template:
(defproject photo-api "0.1.0-SNAPSHOT"
:description "API for geting data from photos db"
:url "http://soulflyer.com"
:dependencies [[cider/cider-nrepl "0.14.0"]
[clj-time "0.13.0"]
[com.google.guava/guava "20.0"]
[com.novemberain/monger "3.1.0" :exclusions [com.google.guava/guava]]
[compojure "1.6.0"]
[cprop "0.1.10"]
[funcool/struct "1.0.0"]
[luminus-immutant "0.2.3"]
[luminus-nrepl "0.1.4"]
[luminus/ring-ttl-session "0.3.2"]
[markdown-clj "0.9.99"]
[metosin/compojure-api "1.1.10"]
[metosin/muuntaja "0.3.1"]
[metosin/ring-http-response "0.9.0"]
[mount "0.1.11"]
[org.clojure/clojure "1.8.0"]
[org.clojure/tools.cli "0.3.5"]
[org.clojure/tools.logging "0.4.0"]
[org.clojure/data.json "0.2.6"]
[org.webjars.bower/tether "1.4.0"]
[org.webjars/bootstrap "4.0.0-alpha.5"]
[org.webjars/font-awesome "4.7.0"]
[org.webjars/jquery "3.1.1"]
[ring-webjars "0.2.0"]
[ring/ring-core "1.6.1"]
[ring/ring-defaults "0.3.0"]
[selmer "1.10.7"]
[image-lib "0.2.1-SNAPSHOT"]]
:min-lein-version "2.0.0"
:jvm-opts ["-server" "-Dconf=.lein-env"]
:source-paths ["src/clj"]
:test-paths ["test/clj"]
:resource-paths ["resources"]
:target-path "target/%s/"
:main ^:skip-aot photo-api.core
:plugins [[lein-cprop "1.0.3"]
[org.clojars.punkisdead/lein-cucumber "1.0.5"]
[lein-immutant "2.1.0"]]
:cucumber-feature-paths ["test/clj/features"]
:profiles
{:uberjar {:omit-source true
:aot :all
:uberjar-name "photo-api.jar"
:source-paths ["env/prod/clj"]
:resource-paths ["env/prod/resources"]}
:dev [:project/dev :profiles/dev]
:test [:project/dev :project/test :profiles/test]
:project/dev {:dependencies [[prone "1.1.4"]
[ring/ring-mock "0.3.0"]
[ring/ring-devel "1.6.1"]
[pjstadig/humane-test-output "0.8.2"]
[clj-webdriver/clj-webdriver "0.7.2"]
[org.apache.httpcomponents/httpcore "4.4"]
[org.clojure/core.cache "0.6.3"]
[org.seleniumhq.selenium/selenium-server "2.48.2"]]
:plugins [[com.jakemccrary/lein-test-refresh "0.19.0"]
[refactor-nrepl "2.3.0-SNAPSHOT"]]
:source-paths ["env/dev/clj"]
:resource-paths ["env/dev/resources"]
:repl-options {:init-ns user}
:injections [(require 'pjstadig.humane-test-output)
(pjstadig.humane-test-output/activate!)]}
:project/test {:resource-paths ["env/test/resources"]}
:profiles/dev {}
:profiles/test {}})
I think you're just missing required configuration - at least Mongo connection string.
When running in dev mode, the luminus (and cprops configuration library) uses the config from your profiles.clj.
However, this is the leiningen thing and it's not available when running from uberjar.
You can specify all your "production" configuration in "config.edn" file and run uberjar like this:
java -Dconf=config.edn -jar target/uberjar/photo-api.jar
You can also use java system properties to set configuration values one by one.
See http://www.luminusweb.net/docs/environment.md for more details.
I have problem with the Carmine uberjar compile (lein with-profile embed uberjar). Maybe very easy the answer, but I didn't get any help from other forums. The lein ring server-headless 8080 run correctly. If I run this command lein with-profile embed uberjar, then I got this error message. Could you help me, what is the correct setup?
Thanks in advance,
RRR
(defproject fu "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:min-lein-version "2.0.0"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]
[ring "1.3.2"]
[compojure "1.5.1"]
[ring/ring-defaults "0.2.1"]
[hiccup "1.0.5"]
[selmer "1.10.3"]
[com.cemerick/friend "0.2.0"]
[de.ubercode.clostache/clostache "1.4.0"]
[com.taoensso/carmine "2.15.0"]]
:main fu.handler
:plugins [[lein-ring "0.9.7"]]
:ring {:handler fu.handler/app
:auto-reload? true
:auto-refresh? true}
:aot [fu.handler]
:uberjar-name "fu-example-default.jar"
:profiles {
:provided {:dependencies [[nginx-clojure "0.4.4"]]}
:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
[ring/ring-mock "0.3.0"]]}
:embed {:dependencies
[[nginx-clojure/nginx-clojure-embed "0.4.4"]]
:aot [fu.handler]
:main fu.handler
:uberjar-name "fu-example-embed.jar"
}
})
ERROR message:
lein with-profile embed uberjar
WARNING: You're currently running as root; probably by accident.
Press control-C to abort or Enter to continue as root.
Set LEIN_ROOT to disable this warning.
Compiling fu.handler
Compiling fu.handler
nil
Exception in thread "main" java.lang.ExceptionInInitializerError, compiling:(/tmp/form-init8960082151990763547.clj:1:73)
at clojure.lang.Compiler.load(Compiler.java:7391)
at clojure.lang.Compiler.loadFile(Compiler.java:7317)
at clojure.main$load_script.invokeStatic(main.clj:275)
at clojure.main$init_opt.invokeStatic(main.clj:277)
at clojure.main$init_opt.invoke(main.clj:277)
at clojure.main$initialize.invokeStatic(main.clj:308)
at clojure.main$null_opt.invokeStatic(main.clj:342)
at clojure.main$null_opt.invoke(main.clj:339)
at clojure.main$main.invokeStatic(main.clj:421)
at clojure.main$main.doInvoke(main.clj:384)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at clojure.lang.RT.classForName(RT.java:2168)
at clojure.lang.RT.classForName(RT.java:2177)
at clojure.lang.RT.loadClassForName(RT.java:2196)
at clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:419)
at clojure.core$load$fn__5677.invoke(core.clj:5893)
at clojure.core$load.invokeStatic(core.clj:5892)
at clojure.core$load.doInvoke(core.clj:5876)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invokeStatic(core.clj:5697)
at clojure.core$compile$fn__5682.invoke(core.clj:5903)
at clojure.core$compile.invokeStatic(core.clj:5903)
at clojure.core$compile.invoke(core.clj:5895)
at user$eval20$fn__29.invoke(form-init8960082151990763547.clj:1)
at user$eval20.invokeStatic(form-init8960082151990763547.clj:1)
at user$eval20.invoke(form-init8960082151990763547.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6927)
at clojure.lang.Compiler.eval(Compiler.java:6917)
at clojure.lang.Compiler.eval(Compiler.java:6917)
at clojure.lang.Compiler.load(Compiler.java:7379)
... 14 more
Caused by: java.lang.ClassCastException: taoensso.carmine.protocol.Context cannot be cast to taoensso.carmine.protocol.Context
at taoensso.carmine.commands$enqueue_request.invokeStatic(commands.clj:211)
at taoensso.carmine.commands$enqueue_request.invoke(commands.clj:196)
at taoensso.carmine$keys.invokeStatic(carmine.clj:128)
at taoensso.carmine$keys.invoke(carmine.clj:128)
at fu.handler$fn__8942$fn__8943$fn__8944.invoke(handler.clj:35)
at taoensso.carmine.protocol$_with_replies.invokeStatic(protocol.clj:340)
at taoensso.carmine.protocol$_with_replies.invoke(protocol.clj:328)
at fu.handler$fn__8942$fn__8943.invoke(handler.clj:35)
at fu.handler$fn__8942.invokeStatic(handler.clj:35)
at fu.handler$fn__8942.invoke(handler.clj:35)
at fu.handler__init.load(Unknown Source)
at fu.handler__init.<clinit>(Unknown Source)
... 36 more
Compilation failed: Subprocess failed
Uberjar aborting because jar failed: Compilation failed: Subprocess failed
Error encountered performing task 'uberjar' with profile(s): 'embed'
Uberjar aborting because jar failed: Compilation failed: Subprocess failed
With monger I found what is the problem source. Redis can accept to use qualifield keywords eg. "#{::user}". But when compiled the script.. works like mongodb, can't read anymore keywords. You can write, but not read. Maybe that is a bug.. (by the way, just in case when we compiled with uberjar..)
I'm trying to include midje "facts" alongside my source code in a project which uses aot. Trying to access the repl or run the project results in the following error, I've included a minimal sample project which reproduces the issue. Thanks for any help!
project.clj
(defproject test-midje "0.1.1"
:description "Why doesn't midje work?"
:min-lein-version "2.0.0"
:source-paths ["src/clj"]
:repl-options {
:timeout 120000
}
:main org.midjetest.core
:profiles {:dev {:dependencies [[midje "1.5.0"]]}}
:aot [org.midjetest.core])
src/clj/org/midjetest/core.clj
(ns org.midjetest.core
(:require [midje.sweet :refer [fact facts]]))
(defn addtwo [a] (+ 2 a))
(fact "addtwo adds two to numbers"
(addtwo 3) => 5)
(defn -main
"testing with main"
([] (println (addtwo 5))))
lein run or lein repl give the following error:
$ lein repl
Compiling org.midjetest.core
Exception in thread "main" java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at clojure.lang.RT.loadClassForName(RT.java:2056)
at clojure.lang.RT.load(RT.java:419)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at org.midjetest.core$loading__4784__auto__.invoke(core.clj:1)
at org.midjetest.core__init.load(Unknown Source)
at org.midjetest.core__init.<clinit>(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at clojure.lang.RT.loadClassForName(RT.java:2056)
at clojure.lang.RT.load(RT.java:419)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at user$eval5.invoke(form-init9180276290836069038.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6500)
at clojure.lang.Compiler.eval(Compiler.java:6500)
at clojure.lang.Compiler.load(Compiler.java:6952)
at clojure.lang.Compiler.loadFile(Compiler.java:6912)
at clojure.main$load_script.invoke(main.clj:283)
at clojure.main$init_opt.invoke(main.clj:288)
at clojure.main$initialize.invoke(main.clj:316)
at clojure.main$null_opt.invoke(main.clj:349)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Caused by: java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:333)
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:988)
at clojure.lang.Namespace.find(Namespace.java:188)
at clojure.core$find_ns.invoke(core.clj:3659)
at clojure.core$the_ns.invoke(core.clj:3691)
at clojure.core$ns_name.invoke(core.clj:3698)
at midje.Bootstrap$bootstrap.invoke(Bootstrap.clj:8)
at midje.sweet__init.load(Unknown Source)
at midje.sweet__init.<clinit>(Unknown Source)
... 53 more
Exception in thread "Thread-4" clojure.lang.ExceptionInfo: Subprocess failed {:exit-code 1}
at clojure.core$ex_info.invoke(core.clj:4327)
at leiningen.core.eval$fn__3532.invoke(eval.clj:226)
at clojure.lang.MultiFn.invoke(MultiFn.java:231)
at leiningen.core.eval$eval_in_project.invoke(eval.clj:326)
at clojure.lang.AFn.applyToHelper(AFn.java:167)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:619)
at leiningen.repl$server$fn__7443.invoke(repl.clj:201)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:617)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1788)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:621)
at clojure.core$bound_fn_STAR_$fn__4102.doInvoke(core.clj:1810)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:744)
The root problem here is that Bootstrap.clj is just not going to work when AOT-ed; it depends on some namespace being loaded before it is; however the static initializers for clojure AOTed classes are more or less equivalent to:
(binding [clojure.core/*ns* nil
clojure.core/*fn-loader* loader
clojure.core/*read-eval* true]
(my.class/load))
Since Bootstrap/bootstrap is called before midje.sweet defines it's own ns (https://github.com/marick/Midje/blob/master/src/midje/sweet.clj#L2), *ns* stays null, and (ns-name *ns*) crashes.
I don't think you can make this work, unless the bootstrap code for midje changes. I'd recommend putting your tests into separate files, and not aot-ing those.