weavejester / lein-ring

Ring plugin for Leiningen
Eclipse Public License 1.0
502 stars 100 forks source link

lein ring war fails #150

Closed timur-han closed 9 years ago

timur-han commented 9 years ago

Hi,

lein ring war fails. I can run the server with lein ring server and lein ring uberjar works as well. I receive the following error. Any ideas about the problem?
Versions: Leiningen 2.5.1 on Java 1.8.0_25 Java HotSpot(TM) 64-Bit Server VM lein-ring "0.9.1"

lein ring war Compiling ClojureScript. java.lang.NullPointerException: null at clojure.core$namespace.invoke (core.clj:1526) leiningen.ring.war$default_servlet_class.invoke (war.clj:50) leiningen.ring.war$servlet_class.invoke (war.clj:60) leiningen.ring.war$servlet_ns.invoke (war.clj:63) leiningen.ring.war$compile_servlet.invoke (war.clj:146) leiningen.ring.war$war.invoke (war.clj:249) leiningen.ring.war$war.invoke (war.clj:240) clojure.lang.AFn.applyToHelper (AFn.java:154) clojure.lang.AFn.applyTo (AFn.java:144) clojure.core$apply.invoke (core.clj:626) leiningen.ring$ring.doInvoke (ring.clj:27) clojure.lang.RestFn.invoke (RestFn.java:425) clojure.lang.Var.invoke (Var.java:383) clojure.lang.AFn.applyToHelper (AFn.java:156) clojure.lang.Var.applyTo (Var.java:700) clojure.core$apply.invoke (core.clj:626) leiningen.core.main$partial_task$fn6094.doInvoke (main.clj:263) clojure.lang.RestFn.applyTo (RestFn.java:139) clojure.lang.AFunction$1.doInvoke (AFunction.java:29) clojure.lang.RestFn.applyTo (RestFn.java:137) clojure.core$apply.invoke (core.clj:626) leiningen.core.main$apply_task.invoke (main.clj:313) leiningen.core.main$resolve_and_apply.invoke (main.clj:319) leiningen.core.main$_main$fn6160.invoke (main.clj:392) leiningen.core.main$_main.doInvoke (main.clj:385) clojure.lang.RestFn.invoke (RestFn.java:421) clojure.lang.Var.invoke (Var.java:383) clojure.lang.AFn.applyToHelper (AFn.java:156) clojure.lang.Var.applyTo (Var.java:700) clojure.core$apply.invoke (core.clj:624) clojure.main$main_opt.invoke (main.clj:315) clojure.main$main.doInvoke (main.clj:420) clojure.lang.RestFn.invoke (RestFn.java:457) clojure.lang.Var.invoke (Var.java:394) clojure.lang.AFn.applyToHelper (AFn.java:165) clojure.lang.Var.applyTo (Var.java:700) clojure.main.main (main.java:37)

MichaelBlume commented 9 years ago

Hi there.

Can you tell me what version of lein-ring you're using? Are there versions of lein-ring where you don't have the problem? Can you show me a sample project which fails?

On Fri Jan 30 2015 at 12:21:54 PM timur87 notifications@github.com wrote:

Hi,

lein ring war fails. I can run the server with lein ring server and lein ring uberjar works as well. I receive the following error. Any ideas about the problem?

lein ring war Compiling ClojureScript. java.lang.NullPointerException: null at clojure.core$namespace.invoke (core.clj:1526) leiningen.ring.war$default_servlet_class.invoke (war.clj:50) leiningen.ring.war$servlet_class.invoke (war.clj:60) leiningen.ring.war$servlet_ns.invoke (war.clj:63) leiningen.ring.war$compile_servlet.invoke (war.clj:146) leiningen.ring.war$war.invoke (war.clj:249) leiningen.ring.war$war.invoke (war.clj:240) clojure.lang.AFn.applyToHelper (AFn.java:154) clojure.lang.AFn.applyTo (AFn.java:144) clojure.core$apply.invoke (core.clj:626) leiningen.ring$ring.doInvoke (ring.clj:27) clojure.lang.RestFn.invoke (RestFn.java:425) clojure.lang.Var.invoke (Var.java:383) clojure.lang.AFn.applyToHelper (AFn.java:156) clojure.lang.Var.applyTo (Var.java:700) clojure.core$apply.invoke (core.clj:626) leiningen.core.main$partial_task$fn6094.doInvoke (main.clj:263) clojure.lang.RestFn.applyTo (RestFn.java:139) clojure.lang.AFunction$1.doInvoke (AFunction.java:29) clojure.lang.RestFn.applyTo (RestFn.java:137) clojure.core$apply.invoke (core.clj:626) leiningen.core.main$apply_task.invoke (main.clj:313) leiningen.core.main$resolve_and_apply.invoke (main.clj:319) leiningen.core.main$_main$fn6160.invoke (main.clj:392) leiningen.core.main$_main.doInvoke (main.clj:385) clojure.lang.RestFn.invoke (RestFn.java:421) clojure.lang.Var.invoke (Var.java:383) clojure.lang.AFn.applyToHelper (AFn.java:156) clojure.lang.Var.applyTo (Var.java:700) clojure.core$apply.invoke (core.clj:624) clojure.main$main_opt.invoke (main.clj:315) clojure.main$main.doInvoke (main.clj:420) clojure.lang.RestFn.invoke (RestFn.java:457) clojure.lang.Var.invoke (Var.java:394) clojure.lang.AFn.applyToHelper (AFn.java:165) clojure.lang.Var.applyTo (Var.java:700) clojure.main.main (main.java:37)

— Reply to this email directly or view it on GitHub https://github.com/weavejester/lein-ring/issues/150.

timur-han commented 9 years ago

Leiningen 2.5.1 on Java 1.8.0_25 Java HotSpot(TM) 64-Bit Server VM lein-ring "0.9.1"

I tried also with version 0.8.11 which did not work either.

Now, I tried it with version 0.7.5, and got the following error:

Exception in thread "main" java.io.FileNotFoundException: Could not locate ring/util/request__init.class or ring/util/request.clj on classpath: , compiling:(workflow.clj:1:1)

May be that's a hint?

MichaelBlume commented 9 years ago

Interesting. Any chance I can see your project.clj?

On Fri Jan 30 2015 at 2:23:18 PM timur87 notifications@github.com wrote:

Leiningen 2.5.1 on Java 1.8.0_25 Java HotSpot(TM) 64-Bit Server VM lein-ring "0.9.1"

I tried also with version 0.8.11 which did not work either.

Now, I tried it with version 0.7.5, and got the following error:

Exception in thread "main" java.io.FileNotFoundException: Could not locate ring/util/request__init.class or ring/util/request.clj on classpath: , compiling:(workflow.clj:1:1)

May be that's a hint?

— Reply to this email directly or view it on GitHub https://github.com/weavejester/lein-ring/issues/150#issuecomment-72280793 .

timur-han commented 9 years ago

Here it is

(defproject myproject "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License - v 1.0"
            :url "http://www.eclipse.org/legal/epl-v10.html"
            :comments "same as Clojure"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [compojure "1.1.8"]
                 [liberator "0.12.2"]
                 [enlive "1.1.5"]
                 [com.novemberain/monger "2.0.0"]
                 [com.cemerick/friend "0.2.1"]
                 [friend-oauth2 "0.1.1"]
                 [enfocus "2.1.0"]
                 [hiccup "1.0.5"]
                 [cljs-ajax "0.3.3"]
                 [ring/ring-core "1.3.2"]
                 [com.taoensso/timbre "3.3.1"]
                 [org.clojure/clojurescript "0.0-2371"]
                 [tailrecursion/ring-proxy "2.0.0-SNAPSHOT"]
                 [clojure-saxon "0.9.4"]
                 [com.cemerick/url "0.1.1"]
                 [into-edn "1.0.2"]
                 [org.clojure/data.xml "0.0.8"]
                 [org.clojure/data.zip "0.1.1"]]
  :java-source-paths ["src/main/java"]
  :resource-paths ["src/main/resources" "src/main/web-app"]
  :source-paths ["src/main/clj"]
  :target-path "target/%s/"
  ;; Directory in which to place AOT-compiled files. Including %s will
  ;; splice the :target-path into this value.
  :compile-path "%s/classy-files"
  ; ;:compile-path "bin/"
  :profiles  {:dev
              {:dependencies [[javax.servlet/servlet-api "2.5"]
                              [ring-mock "0.1.5"]]
               :plugins [[lein-ring "0.9.1"]
                         [lein-idefiles "0.2.1"]
                         [lein-cljsbuild "1.0.3"]
                         [com.cemerick/austin "0.1.4"]
                         [lein-less "1.7.2"]
                         [lein-bower "0.5.1"]
                         [cider/cider-nrepl "0.8.2"]]
               :ring {:handler main/myapp}
               :less {:source-paths ["src/main/web-app/public/stylesheets"]
                      :target-path "src/main/web-app/public/stylesheets"}
               :hooks [leiningen.cljsbuild]
               :bower-dependencies [[angular "1.2.x"]
                                    [angular-route "1.2.x"]
                                    [angular-loader "1.2.x"]
                                    [angular-mocks "~1.2.x"]
                                    [html5-boilerplate "~4.3.0"]
                                    [bootstrap "~3.1.1"]
                                    [angular-resource "~1.2.16"]
                                    [angular-ui-router "~0.2.10"]]
               :bower {:directory "src/main/web-app/public/js/vendors"}}}
  :cljsbuild {
              :builds [{
                                        ; The path to the top-level ClojureScript source directory:
                                        :source-paths ["src/main/cljs"]
                                        ; The standard ClojureScript compiler options:
                                        ; (See the ClojureScript compiler documentation for details.)
                                        :compiler {
                                                   :output-to "src/main/web-app/public/js/main.js"  ; default: target/cljsbuild-main.js
                                                   :optimizations :whitespace
                                                   :pretty-print true}}]})
MichaelBlume commented 9 years ago

Ok, looks like the trouble is your ring config is inside the dev profile. The dev profile isn't active when you're creating artifacts for deployment, like wars, so it doesn't see a handler and errors out.

We could do a better job of reporting this, though.

On Fri Jan 30 2015 at 2:45:17 PM timur87 notifications@github.com wrote:

Here it is

(defproject myproject "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License - v 1.0" :url "http://www.eclipse.org/legal/epl-v10.html" :comments "same as Clojure"} :dependencies [[org.clojure/clojure "1.6.0"] [compojure "1.1.8"] [liberator "0.12.2"] [enlive "1.1.5"] [com.novemberain/monger "2.0.0"] [com.cemerick/friend "0.2.1"] [friend-oauth2 "0.1.1"] [enfocus "2.1.0"] [hiccup "1.0.5"] [cljs-ajax "0.3.3"] [ring/ring-core "1.3.2"] [com.taoensso/timbre "3.3.1"] [org.clojure/clojurescript "0.0-2371"] [tailrecursion/ring-proxy "2.0.0-SNAPSHOT"] [clojure-saxon "0.9.4"] [com.cemerick/url "0.1.1"] [into-edn "1.0.2"] [org.clojure/data.xml "0.0.8"] [org.clojure/data.zip "0.1.1"]] :java-source-paths ["src/main/java"] :resource-paths ["src/main/resources" "src/main/web-app"] :source-paths ["src/main/clj"] :target-path "target/%s/" ;; Directory in which to place AOT-compiled files. Including %s will ;; splice the :target-path into this value. :compile-path "%s/classy-files" ; ;:compile-path "bin/" :profiles {:dev {:dependencies [[javax.servlet/servlet-api "2.5"] [ring-mock "0.1.5"]] :plugins [[lein-ring "0.9.1"] [lein-idefiles "0.2.1"] [lein-cljsbuild "1.0.3"] [com.cemerick/austin "0.1.4"] [lein-less "1.7.2"] [lein-bower "0.5.1"] [cider/cider-nrepl "0.8.2"]] :ring {:handler main/myapp} :less {:source-paths ["src/main/web-app/public/stylesheets"] :target-path "src/main/web-app/public/stylesheets"} :hooks [leiningen.cljsbuild] :bower-dependencies [[angular "1.2.x"] [angular-route "1.2.x"] [angular-loader "1.2.x"] [angular-mocks "~1.2.x"] [html5-boilerplate "~4.3.0"] [bootstrap "~3.1.1"] [angular-resource "~1.2.16"] [angular-ui-router "~0.2.10"]] :bower {:directory "src/main/web-app/public/js/vendors"}}} :cljsbuild { :builds [{ ; The path to the top-level ClojureScript source directory: :source-paths ["src/main/cljs"] ; The standard ClojureScript compiler options: ; (See the ClojureScript compiler documentation for details.) :compiler { :output-to "src/main/web-app/public/js/main.js" ; default: target/cljsbuild-main.js :optimizations :whitespace :pretty-print true}}]})

— Reply to this email directly or view it on GitHub https://github.com/weavejester/lein-ring/issues/150#issuecomment-72283770 .

timur-han commented 9 years ago

Yes that was it, worked like a charm. Thanks for the assistance.

MichaelBlume commented 9 years ago

No problem =)

On Fri Jan 30 2015 at 3:14:31 PM timur87 notifications@github.com wrote:

Yes that was it, worked like a charm. Thanks for the assistance.

— Reply to this email directly or view it on GitHub https://github.com/weavejester/lein-ring/issues/150#issuecomment-72287356 .