Cannot Eval Clojure in Lighttable - clojure

I'm learning lighttable and clojure now. but i have a problem that says permission denied when I try to eval my clojure script.
Here's the 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 A local light table project, :compile-path /opt/LightTable/resources/app/plugins/Clojure/runner/resources/target/classes, :deploy-repositories [[clojars {:url https://clojars.org/repo/, :password :gpg, :username :gpg}]], :group local-client, :resource-paths (/opt/LightTable/resources/app/plugins/Clojure/runner/resources/dev-resources /opt/LightTable/resources/app/plugins/Clojure/runner/resources/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__949__951__auto__ p2__950__952__auto__] (clojure.core/str p1__949__951__auto__
p2__950__952__auto__)) clojure.core/spit]}, :name local-client, :checkout-deps-shares [:source-paths :test-paths :resource-paths :compile-path #'leiningen.core.classpath/checkout-deps-paths], :source-paths (/opt/LightTable/resources/app/plugins/Clojure/runner/resources/src), :eval-in :subprocess, :repositories [[central {:url https://repo1.maven.org/maven2/, :snapshots false}] [clojars {:url https://clojars.org/repo/}]], :test-paths (/opt/LightTable/resources/app/plugins/Clojure/runner/resources/test), :target-path /opt/LightTable/resources/app/plugins/Clojure/runner/resources/target, :prep-tasks [javac compile], :native-path /opt/LightTable/resources/app/plugins/Clojure/runner/resources/target/native, :offline? false, :root /opt/LightTable/resources/app/plugins/Clojure/runner/resources, :pedantic? ranges, :clean-targets [:target-path], :plugins [], :plugin-repositories [[central {:url https://repo1.maven.org/maven2/, :snapshots false}] [clojars {:url https://clojars.org/repo/}]], :version 0.0.1, :jar-exclusions [#"^\."], :global-vars {}, :uberjar-exclusions [#"(?i)^META-INF/[^/]*\.(SF|RSA|DSA)$"], :jvm-opts [], :dependencies ([org.clojure/clojure 1.5.1] [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.1.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 LightTable-REPL, :project (quote {:description A local light table project, :compile-path /opt/LightTable/resources/app/plugins/Clojure/runner/resources/target/classes, :deploy-repositories [[clojars {:url https://clojars.org/repo/, :password :gpg, :username :gpg}]], :group local-client, :resource-paths (/opt/LightTable/resources/app/plugins/Clojure/runner/resources/dev-resources /opt/LightTable/resources/app/plugins/Clojure/runner/resources/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__949__951__auto__ p2__950__952__auto__] (clojure.core/str p1__949__951__auto__
p2__950__952__auto__)) clojure.core/spit]}, :name local-client, :checkout-deps-shares [:source-paths :test-paths :resource-paths :compile-path #'leiningen.core.classpath/checkout-deps-paths], :source-paths (/opt/LightTable/resources/app/plugins/Clojure/runner/resources/src), :eval-in :subprocess, :repositories [[central {:url https://repo1.maven.org/maven2/, :snapshots false}] [clojars {:url https://clojars.org/repo/}]], :test-paths (/opt/LightTable/resources/app/plugins/Clojure/runner/resources/test), :target-path /opt/LightTable/resources/app/plugins/Clojure/runner/resources/target, :prep-tasks [javac compile], :native-path /opt/LightTable/resources/app/plugins/Clojure/runner/resources/target/native, :offline? false, :root /opt/LightTable/resources/app/plugins/Clojure/runner/resources, :pedantic? ranges, :clean-targets [:target-path], :plugins [], :plugin-repositories [[central {:url https://repo1.maven.org/maven2/, :snapshots false}] [clojars {:url https://clojars.org/repo/}]], :version 0.0.1, :jar-exclusions [#"^\."], :global-vars {}, :uberjar-exclusions [#"(?i)^META-INF/[^/]*\.(SF|RSA|DSA)$"], :jvm-opts [], :dependencies ([org.clojure/clojure 1.5.1] [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)}}
java.io.IOException: Permission denied. Please check your access rights for /opt/LightTable/resources/app/plugins/Clojure/runner/resources/.nrepl-port
at leiningen.repl$repl.doInvoke(repl.clj:317)
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.applyTo(RestFn.java:137)
at leiningen.light_nrepl.main(Unknown Source)
I know it's about permission, but i don't know which folder/files should I change the permission. I already do chown in all over plugins folder
I'm using Lighttable IDE in Manjaro

Probably not the same underlying cause, since yours doesn't seem to be on MacOS, but the same error shows up due to App Translocation.
On recent versions of MacIS there is a security feature called App Translocation that runs apps on a read-only file system (see http://lapcatsoftware.com/articles/app-translocation.html and https://objective-see.com/blog/blog_0x15.html).
The Light Table permissions error will involve the path /private/var/folders/.../AppTranslocation...
To fix this, put both LightTable.app and light in the /Applications folder. For each of them, go through the process for allowing unsigned apps (http://www.macworld.com/article/3094865/macs/how-to-run-apps-that-are-not-from-the-app-store-in-macos-sierra.html). Then, rather than starting LightTable.app, start light instead (this will also start a console window).

Please check your access rights for /opt/LightTable/resources/app/plugins/Clojure/runner/resources/.nrepl-port
Looks like it has something to do with you clojure plug-in in LightTalbe
Highly suggest that check your LightTable's configuration

Related

Unable to build standalone jar using boot

EDIT: Added more information at the end. Also, got war to run with jetty-runner.jar (not with tomcat however)
I am using boot as the build tool for my clojure application.
This is the first application I have written with cljs, cljc and clj code (along with sass) all in one project.
My build.boot has the following task-options
(def db-opts (:db (clojure.edn/read-string (slurp "resources/config.edn"))))
(task-options!
pom {:project 'gcr
:version "0.1"}
cljs {:optimizations :simple}
uber {:as-jars true}
war {:file "gcr.war"}
ragtime {:database (str "jdbc:"
(:dbtype db-opts) "://"
(:user db-opts) ":"
(:password db-opts) "#"
(:host db-opts) ":"
(:port db-opts) "/"
(:dbname db-opts))}
test {:include #"gcr.test"
:junit-output-to "junit-out"})
my build task is defined as follows:
(deftask build
"Builds an uberjar of this project that can be run with java -jar"
[]
(comp
(aot :all true ;; :namespace #{'gcr.server}
)
(pom)
(cljs :optimizations :simple)
(sass)
(uber)
(jar :file "gcr.jar" :main 'gcr.server)
(sift :include #{#"gcr.jar"})
(target)))
When i run boot build the project builds fine without any errors.
But when I run java -jar target/gcr.jar
I get the following:
$ java -jar target/gcr.jar
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true
Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/Var
at gcr.server.<clinit>(Unknown Source)
Caused by: java.lang.ClassNotFoundException: clojure.lang.Var
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
I have been looking at this for about 24 hours now and still unable to figure out how to get this working. (I finally was able to build a war that works with jetty-runner but not on tomcat)
----------
Some more info:
My boot.properties is
BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_CLOJURE_VERSION=1.10.0
BOOT_VERSION=2.8.2
and I am using openjdk version "1.8.0_202"
I checked if the jar file built has the clojure jar using jar tf target/gcr.jar and the following line is listed:
7c506484bc48541ffa5dcb4d9366a8a2-clojure-1.10.0.jar
My IFDE works fine, I have the following dev task defined as follows:
(deftask dev
"Launch Immediate Feedback Development Environment"
[]
(comp
(serve :handler 'gcr.core/app ;; ring handler
:resource-root "public" ;; root classpath
:reload true) ;; reload ns
(watch)
(reload)
(cljs-repl) ;; before cljs task
(cljs)
(sass)
(target :dir #{"public"})))
set-env! part is as follows:
(set-env!
:source-paths #{"src/scss" "src/clj" "src/cljs" "src/cljc"}
:resource-paths #{"html" "resources"}
:dependencies '[[org.clojure/clojure "1.10.0"]
[org.clojure/clojurescript "1.10.520"]
;; server
[compojure "1.6.1"]
[ring/ring-core "1.7.1"]
[ring/ring-jetty-adapter "1.7.1"]
[ring/ring-json "0.4.0"]
[ring-middleware-format "0.7.4"]
;; [javax.servlet/servlet-api "2.5" :scope "test"]
;; [yogthos/config "1.1.1"]
;; java 10 upgrade
[javax.xml.bind/jaxb-api "2.4.0-b180830.0359"]
;; common
[org.clojure/core.async "0.4.490"]
[org.clojars.akiel/async-error "0.3"]
[hickory "0.7.1"]
[instaparse "1.4.10"]
;; clj
[clj-time "0.15.1"]
[clj-http "3.9.1"]
[clout "2.2.1"]
[org.clojure/data.json "0.2.6"]
[org.clojure/data.codec "0.1.1"] ;; Base64
;; cljs
[com.andrewmcveigh/cljs-time "0.5.2"]
[prismatic/dommy "1.1.0"]
[hipo "0.5.2"]
[hodgepodge "0.1.3"]
[cljs-http "0.1.46"]
[com.cemerick/url "0.1.1"]
[reagent "0.8.1"]
;; db
[ragtime "0.8.0"] ;; Migrations
[hikari-cp "2.7.1"] ;; Connection Pooling
[org.clojure/java.jdbc "0.7.9"]
[honeysql "0.9.4"]
[org.postgresql/postgresql "42.2.5"]
;; Authentication framework with JWT
[buddy/buddy-auth "2.1.0"]
[buddy/buddy-core "1.5.0"]
[buddy/buddy-sign "3.0.0"]
;; argon2 for password hashing
[de.mkammerer/argon2-jvm "2.5"]
;; logging
[com.taoensso/timbre "4.10.0"] ;; logging
[com.fzakaria/slf4j-timbre "0.3.12"]
[org.slf4j/log4j-over-slf4j "1.7.26"]
[org.slf4j/jul-to-slf4j "1.7.26"]
[org.slf4j/jcl-over-slf4j "1.7.26"]
;; spec , test & gen
[org.clojure/test.check "0.9.0"]
;; Dependencies for build process
[adzerk/boot-cljs "2.1.5"]
[adzerk/boot-test "1.2.0" :scope "test"]
[pandeiro/boot-http "0.8.3"]
[adzerk/boot-reload "0.6.0"]
[adzerk/boot-cljs-repl "0.4.0"]
[cider/piggieback "0.3.9" :scope "test"]
[nrepl "0.4.5" :scope "test"]
;; [com.cemerick/piggieback "0.2.2" :scope "test"]
[weasel "0.7.0" :scope "test"]
[org.clojure/tools.nrepl "0.2.13" :scope "test"]
[mbuczko/boot-ragtime "0.3.1"]
[deraen/boot-sass "0.3.1"]
[tolitius/boot-check "0.1.12"]])
After a lot of playing around with tasks, I was able to build a war file that works with jetty-runner with the following task:
(deftask build-war
"Build the target/app.war file"
[]
(comp
(aot :all true)
(web :serve 'gcr.core/app)
(cljs :optimizations :advanced)
(sass)
(sift :move {#"(.*)js$" "public/$1js"
#"(.*)html$" "public/$1html"
#"css/(.*)" "public/css/$1"})
(uber)
(war :file "gcr.war")
(sift :include [#"gcr.war"])
(target)))
Using the sift task to move the static resources to the public folder was key, since I had my compojure resources defined as follows in my routes.clj (not including API and other routes).
(defroutes gen-routes
(GET "/login" [] auth/auth-handler)
(files "/" {:root "public"}) ;; to serve static resources
(resources "/" {:root "public"}) ;; to serve anything else
(not-found "404 Page Not Found")) ;; page not found
This however still does not produce a war file that works on tomcat. That is, on deploying to tomcat, all the API routes works as expected, but the static html files come up as HTTP/404.

Connecting to Repl from Clojure project Light Table

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.

clj-time.coerce java.sql.Date .toString decrements date?

test_ns.clj
(ns test-ns
(:require [clj-time.jdbc :as tj]
[clj-time.coerce :as tc]))
(.toString (tc/to-sql-date (tc/from-string "2018-09-28")))
=> "2018-09-27"
Why does .toString decrement the date?
The expectation is that the formatted date string would match its input
tc/to-sql-date converts to java.sql.Date class
The .toString method appears to be used by hugsql default jbdc adaptor, which is a project dependency used for sql transactions
project.clj:
(defproject my-project "0.1.0-SNAPSHOT"
...
:min-lein-version "2.0.0"
:dependencies [[org.clojure/clojure "1.10.0-beta1"]
[duct/core "0.7.0-alpha8"]
[duct/module.sql "0.5.0-alpha1"]
[duct/module.logging "0.4.0-alpha1"]
[duct/database.sql.hikaricp "0.3.3"]
[com.walmartlabs/lacinia "0.21.0"]
[com.rpl/specter "1.1.1"]
[net.mikera/core.matrix "0.62.0"]
[com.wsscode/pathom "2.2.4"]
[org.clojure/core.async "0.4.474"]
[org.postgresql/postgresql "42.2.5"]
[org.clojure/core.async "0.4.490"]
[com.layerware/hugsql "0.4.9"]
[cheshire "5.8.1"]
[camel-snake-kebab "0.4.0"]
[hickory "0.7.1"]
[incanter "1.9.3"]
[clj-http "3.9.1"]
[environ "1.1.0"]]
:plugins [[lein-environ "1.1.0"]
[duct/lein-duct "0.11.0-alpha6"]
[lein-exec "0.3.7"]]
:main ^:skip-aot portfolio-management.main
:test-paths ["test"]
:source-paths ["src"]
:target-path "target/%s"
:resource-paths ["resources" "target/resources"]
:prep-tasks ["javac" "compile" ["run" ":duct/compiler"]]
:profiles
{:dev [:project/dev :profiles/dev]
:repl {:prep-tasks ^:replace ["javac" "compile"]
:repl-options {:init-ns user}}
:uberjar {:aot :all}
:profiles/dev {}
:project/dev {:source-paths ["dev/src"]
:resource-paths ["dev/resources"]
:dependencies [[integrant/repl "0.3.1"]
[eftest "0.4.1"]
[kerodon "0.9.0"]
]}})
EDIT
~$ java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
I'm pretty sure that this is a timezone issue as Carcigenicate already pointed out.
from-string parses a string in the UTC timezone and java.sql.Date uses the default JVM timezone.
The returned result is correct if you're in a timezone which is "behind" UTC (to the west) because in those timezones the date 2018-09-28 00:00:00 is actually 2017-09-27.
(java.util.TimeZone/setDefault(java.util.TimeZone/getTimeZone "GMT"))
(.toString (tc/to-sql-date (tc/from-string "2018-09-28")))
;; => "2018-09-28"
(java.util.TimeZone/setDefault(java.util.TimeZone/getTimeZone "GMT-1"))
(.toString (tc/to-sql-date (tc/from-string "2018-09-28")))
;; => "2018-09-27"
You shouldn't use java.sql.Date and expect that it returns a date in the UTC timezone as long as that's not your default timezone.

Problems creating an executeable for a luminus clojure project

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.

project.clj understanding some parts

I am create a web application with duct lein template.
Now I am looking at project.clj to see how its works.
But I don't know if I undersant correcntly this particular part:
{:dev [:project/dev :profiles/dev]
:test [:project/test :profiles/test]
:uberjar {:aot :all}
:profiles/dev {}
:profiles/test {}
:project/dev {:dependencies [[duct/generate "0.6.1"]
[reloaded.repl "0.2.1"]
[org.clojure/tools.namespace "0.2.11"]
[org.clojure/tools.nrepl "0.2.12"]
[eftest "0.1.1"]
[kerodon "0.7.0"]]
:source-paths ["dev"]
:repl-options {:init-ns user}
:env {:port "3000"}}
For example:
Whats this [:project/dev :profiles/dev] mean? and why I have a :dev key and a :project/dev key.
I know it is probably about profiles.clj file. But I did don't really understand it right.
Maybe my question seems a little bit silly, but I hope I have been myself clear.
This is described in composite profiles:
Sometimes it is useful to define a profile as a combination of other
profiles. To do this, just use a vector instead of a map as the
profile value. This can be used to avoid duplication:
{:shared {:port 9229, :protocol "https"}
:qa [:shared {:servers ["qa.mycorp.com"]}]
:stage [:shared {:servers ["stage.mycorp.com"]}]
:production [:shared {:servers ["prod1.mycorp.com", "prod1.mycorp.com"]}]}