Closed chenfisher closed 9 years ago
I am also experiencing the same error.
Thanks, checking this out.
I think I might need a bit more information from you to reproduce this, I'm trying with lein-ring 0.9.2 and lein 2.5.1 and can't seem to. Can you tell me what your handler namespace is called? If you could just show me your entire project.clj that would help a lot.
I generated a new project called 'hello-world' using the compojure template as described here and upgraded its dependencies to the latest one. The following project.clj fails:
(defproject hello-world "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:min-lein-version "2.0.0"
:dependencies [[org.clojure/clojure "1.6.0"]
[compojure "1.3.2"]
[ring/ring-defaults "0.1.4"]]
:plugins [[lein-ring "0.9.2"]
[lein-ancient "0.6.4"]]
:ring {:handler hello-world.handler/app}
:profiles
{:uberjar {:aot :all}
:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
[ring-mock "0.1.5"]]}})
The error I get:
Compiling :all
java.io.FileNotFoundException: Could not locate all__init.class or all.clj on classpath:
at clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5066.invoke(core.clj:5641)
at clojure.core$load.doInvoke(core.clj:5640)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5446)
at clojure.core$compile$fn__5071.invoke(core.clj:5652)
at clojure.core$compile.invoke(core.clj:5651)
at user$eval9$fn__16.invoke(form-init3390218296002737571.clj:1)
at user$eval9.invoke(form-init3390218296002737571.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6703)
at clojure.lang.Compiler.eval(Compiler.java:6693)
at clojure.lang.Compiler.load(Compiler.java:7130)
at clojure.lang.Compiler.loadFile(Compiler.java:7086)
at clojure.main$load_script.invoke(main.clj:274)
at clojure.main$init_opt.invoke(main.clj:279)
at clojure.main$initialize.invoke(main.clj:307)
at clojure.main$null_opt.invoke(main.clj:342)
at clojure.main$main.doInvoke(main.clj:420)
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)
Exception in thread "main" java.io.FileNotFoundException: Could not locate all__init.class or all.clj on classpath: , compiling:(/tmp/form-init3390218296002737571.clj:1:72)
at clojure.lang.Compiler.load(Compiler.java:7142)
at clojure.lang.Compiler.loadFile(Compiler.java:7086)
at clojure.main$load_script.invoke(main.clj:274)
at clojure.main$init_opt.invoke(main.clj:279)
at clojure.main$initialize.invoke(main.clj:307)
at clojure.main$null_opt.invoke(main.clj:342)
at clojure.main$main.doInvoke(main.clj:420)
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.io.FileNotFoundException: Could not locate all__init.class or all.clj on classpath:
at clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5066.invoke(core.clj:5641)
at clojure.core$load.doInvoke(core.clj:5640)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5446)
at clojure.core$compile$fn__5071.invoke(core.clj:5652)
at clojure.core$compile.invoke(core.clj:5651)
at user$eval9$fn__16.invoke(form-init3390218296002737571.clj:1)
at user$eval9.invoke(form-init3390218296002737571.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6703)
at clojure.lang.Compiler.eval(Compiler.java:6693)
at clojure.lang.Compiler.load(Compiler.java:7130)
... 11 more
Compilation failed: Subprocess failed
lein ring uberjar
works with v0.9.1 of lein-ring. So the problem seems to be in introduced in v0.9.2.
Thanks, think I found the problem =)
On Mon, Mar 9, 2015 at 10:03 AM Ducky notifications@github.com wrote:
lein ring uberjar works with v0.9.1 of lein-ring. Si the problem seems to be in introduced in v0.9.2.
— Reply to this email directly or view it on GitHub https://github.com/weavejester/lein-ring/issues/153#issuecomment-77896069 .
Ok, should have been fixed by 148afac, sorry for the inconvenience.
@weavejester I think this could use a bugfix release
Thanks @MichaelBlume! :+1:
Thanks guys
@MichaelBlume, It seems your fix introduced #126 once again.
When running lein ring uberjar
with your fix, I get the following warning and the jar is not runnable:
Warning: The Main-Class specified does not exist within the jar. It may not be executable as expected. A gen-class directive may be missing in the namespace which contains the main method.
Removing :aot :all
and running lein ring uberjar
I get the following error:
java.io.FileNotFoundException: Could not locate api/api/main__init.class or api/api/main.clj on classpath
Where api
is the name of my project
(this probably answers your question in #154 about the relation between those two issues)
I can confirm that aot :all
issue has been addressed.
@chenfisher, is this another issue or is this related to #154?
...Ok, that does it, this project needs a test suite, I'm going to start figuring out how to have one.
On Thu, Mar 12, 2015 at 4:16 AM Ducky notifications@github.com wrote:
I can confirm that aot :all issue has been addressed.
@chenfisher https://github.com/chenfisher, is this another issue or is this related to #154 https://github.com/weavejester/lein-ring/issues/154 ?
— Reply to this email directly or view it on GitHub https://github.com/weavejester/lein-ring/issues/153#issuecomment-78461705 .
@ducky427,
I think there are 3 issues that seem to be related to each other:
As I mentioned, it seems they are all related.
@chenfisher I'm going to need more help reproducing your issue
Could you give me a listing of namespaces in your project, and tell me which ones contain your handler and any initializer/destructor you may have?
I'm having the same problem as @chenfisher. I have a simple app I'm trying to deploy to Heroku.
My project.clj looks like so:
(defproject ramsey "1.0.0-SNAPSHOT"
:description "Clojure web app for virtual envelopes"
:jvm-opts []
:url "http://ramsey.herokuapp.com"
:license
{:name "Eclipse Public License v1.0"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:main ramsey.web
:dependencies
[; ==== CLOJURE ====
[org.clojure/clojure "1.7.0-alpha5" ]
; ==== SERVER ====
[compojure "1.1.8" ]
[ring/ring-jetty-adapter "1.2.2" ]
[environ "0.5.0" ]
[com.cemerick/drawbridge "0.0.6" ]
; ==== QUANTUM ====
[quantum/core "0.0.101" ]
;[quantum-cljx/core "0.0.101.3" ] ; 0.0.101.2 works
; ==== TEMP ====
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
; ==== CLOJURESCRIPT ====
[org.clojure/clojurescript "0.0-3058" ]
[org.omcljs/om "0.8.8" ]
[racehub/om-bootstrap "0.3.1" ]
[sablono "0.2.20" ]
[weasel "0.6.0" ]
[figwheel "0.2.5-SNAPSHOT"]
[prismatic/plumbing "0.4.0" ]
[garden "1.2.5" ]
[domina "1.0.3" ]
[com.cemerick/piggieback "0.1.5" ]] ; perhaps 2.3?
:min-lein-version "2.0.0"
:plugins
[[environ/environ.lein "0.2.1"]
;[lein-cljsbuild "1.0.5"]
[com.keminglabs/cljx "0.6.0"]
[lein-cljsbuild "1.0.4"] ; A requirement for figwheel?
[lein-figwheel "0.2.5-SNAPSHOT"]]
:prep-tasks [["cljx" "once"] "javac" "compile"]
:source-paths ["src/clj" "src/cljs"]
:uberjar {:aot :all}
:auto-clean false ; because of https://github.com/weavejester/lein-ring/issues/126
:cljx
{:builds
[{:source-paths ["src/clj" "src/cljx"]
:output-path "target/classes"
:rules :clj}
{:source-paths ["src/cljs" "src/cljx"]
:output-path "target/cljs"
:rules :cljs}]}
:cljsbuild
{:builds
[{:id "ramsey"
:source-paths ["src/cljs"]
:compiler
{:output-to "resources/public/js/ramsey.js"
:output-dir "resources/public/js/out"
:optimizations :none
:cache-analysis true
:source-map-timestamp true
:source-map true}}]}
:figwheel
{:css-dirs ["resources/public/css"]
:open-file-command "emacsclient"}
:hooks [environ.leiningen.hooks]
:uberjar-name "ramsey-standalone.jar"
:profiles
{:dev
{:dependencies
[[org.clojure/tools.nrepl "0.2.7"]
[com.cemerick/piggieback "0.1.5"]]
:plugins
[[com.cemerick/austin "0.1.6"]
[com.cemerick/piggieback "0.1.5"]
[com.keminglabs/cljx "0.6.0"]]
:injections
[(do (ns quanta.main)
(require '[quantum.core.ns :as ns :refer :all])
(ns/require-all *ns* :clj :lib)
(clojure.main/repl :print !))]
:repl-options
{:nrepl-middleware
[cemerick.piggieback/wrap-cljs-repl]}}
:production {:env {:production true}}})
ramsey.web (where the main function is located) looks like this:
(defn -main [& [port]]
(let [port (Integer. (or port (env :port) 5000))]
(jetty/run-jetty (site #'app) {:port port :join? false})))
Strangely, when I simply run lein uberjar
and java -jar <my-uberjar-name.jar>
and thereby run it locally at localhost:5000, then it works just fine. For some reason, deploying it to Heroku is causing problems.
@alexandergunnarson I don't understand, are you using lein ring?
@MichaelBlume, I think I got it.
I have :target-path "target/%s"
in my project.clj and it seems to mess things up. Once I remove it everything works as expected (including your fix for :aot :all)
@chenfisher cool, thanks
closing, at least for now
Just found this #116. This is the exact same issue. I see #142 should have fixed it but it didn't (or was broken later on)
When running
lein ring uberjar
with uberjar profile in project.clj:
:uberjar {:aot :all}
the following error occurs:
(I'm using lein-ring 0.9.2, leiningen 2.5.1)
Thanks for your help