Comments (8)
I'm not sure if this is the only error, but the problem I can see is that you're using with-context-path-info
inside the code you generate, but that function is private, not public.
from lein-ring.
Hmm fair point, but I would expect a IllegalStateException - var: #'lein.ring.war/with-context-path-info is not public
, if that was really the issue here...I'll try it and let you know.
from lein-ring.
Hi there,
So, I've abandoned the idea of providing 2 arities, and I've gone with var-args instead which seems to work:
(defn generate-handler [project handler-sym]
(if (get-in project [:ring :servlet-path-info?] true)
`(let [handler# ~(generate-resolve handler-sym)]
(fn [req# & args#]
(let [context# (.getContextPath
^javax.servlet.http.HttpServletRequest
(:servlet-request req#))]
(apply handler#
(assoc req#
:context context#
:path-info (-> (:uri req#) (subs (count context#)) not-empty (or "/")))
args#))))
(generate-resolve handler-sym)))
I have to admit that I'm not 100% happy with it, but at least it works. Do you want a PR for it, or would you prefer to have a stab at it yourself - see if you can get the 2-arity working?
from lein-ring.
I'd rather figure out why it doesn't work, but I'm not going to have any time to investigate for a while.
from lein-ring.
Like you, I would love to know why it can't compile the 2-arity fn, but at this point I've run out of ideas and things I can try. My custom fork is at version 0.12.23
(with the above code which at least works), so that gives you an idea of how many attempts I've made. The error is not helpful at all :( ...
$ cat /var/folders/zw/c3k5myj97z740h4sqdmnvwsr0000gq/T/clojure-8932508282312467787.edn
{:clojure.main/message
"Syntax error (ClassNotFoundException) compiling at (com/elcom/gw/listener.clj:1:808).\nleiningen.ring.war\n",
:clojure.main/triage
{:clojure.error/phase :compile-syntax-check,
:clojure.error/line 1,
:clojure.error/column 808,
:clojure.error/source "listener.clj",
:clojure.error/path "com/elcom/gw/listener.clj",
:clojure.error/class java.lang.ClassNotFoundException,
:clojure.error/cause "leiningen.ring.war"},
:clojure.main/trace
{:via
[{:type clojure.lang.Compiler$CompilerException,
:message
"Syntax error compiling at (com/elcom/gw/listener.clj:1:808).",
:data
{:clojure.error/phase :compile-syntax-check,
:clojure.error/line 1,
:clojure.error/column 808,
:clojure.error/source "com/elcom/gw/listener.clj"},
:at [clojure.lang.Compiler analyzeSeq "Compiler.java" 7119]}
{:type java.lang.ClassNotFoundException,
:message "leiningen.ring.war",
:at
[java.net.URLClassLoader findClass "URLClassLoader.java" 435]}],
:trace
[[java.net.URLClassLoader findClass "URLClassLoader.java" 435]
[clojure.lang.DynamicClassLoader
findClass
"DynamicClassLoader.java"
69]
[java.lang.ClassLoader loadClass "ClassLoader.java" 589]
[clojure.lang.DynamicClassLoader
loadClass
"DynamicClassLoader.java"
77]
[java.lang.ClassLoader loadClass "ClassLoader.java" 522]
[java.lang.Class forName0 "Class.java" -2]
[java.lang.Class forName "Class.java" 468]
[clojure.lang.RT classForName "RT.java" 2212]
[clojure.lang.RT classForNameNonLoading "RT.java" 2225]
[clojure.lang.Compiler$HostExpr maybeClass "Compiler.java" 1041]
[clojure.lang.Compiler macroexpand1 "Compiler.java" 7049]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 7097]
[clojure.lang.Compiler analyze "Compiler.java" 6793]
[clojure.lang.Compiler analyze "Compiler.java" 6749]
[clojure.lang.Compiler$InvokeExpr parse "Compiler.java" 3892]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 7113]
[clojure.lang.Compiler analyze "Compiler.java" 6793]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 7099]
[clojure.lang.Compiler analyze "Compiler.java" 6793]
[clojure.lang.Compiler analyze "Compiler.java" 6749]
[clojure.lang.Compiler$BodyExpr$Parser parse "Compiler.java" 6124]
[clojure.lang.Compiler$LetExpr$Parser parse "Compiler.java" 6440]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 7111]
[clojure.lang.Compiler analyze "Compiler.java" 6793]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 7099]
[clojure.lang.Compiler analyze "Compiler.java" 6793]
[clojure.lang.Compiler analyze "Compiler.java" 6749]
[clojure.lang.Compiler$BodyExpr$Parser parse "Compiler.java" 6124]
[clojure.lang.Compiler$FnMethod parse "Compiler.java" 5471]
[clojure.lang.Compiler$FnExpr parse "Compiler.java" 4033]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 7109]
[clojure.lang.Compiler analyze "Compiler.java" 6793]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 7099]
[clojure.lang.Compiler analyze "Compiler.java" 6793]
[clojure.lang.Compiler analyze "Compiler.java" 6749]
[clojure.lang.Compiler$BodyExpr$Parser parse "Compiler.java" 6124]
[clojure.lang.Compiler$LetExpr$Parser parse "Compiler.java" 6440]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 7111]
[clojure.lang.Compiler analyze "Compiler.java" 6793]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 7099]
[clojure.lang.Compiler analyze "Compiler.java" 6793]
[clojure.lang.Compiler access$300 "Compiler.java" 38]
[clojure.lang.Compiler$LetExpr$Parser parse "Compiler.java" 6388]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 7111]
[clojure.lang.Compiler analyze "Compiler.java" 6793]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 7099]
[clojure.lang.Compiler analyze "Compiler.java" 6793]
[clojure.lang.Compiler analyze "Compiler.java" 6749]
[clojure.lang.Compiler$BodyExpr$Parser parse "Compiler.java" 6124]
[clojure.lang.Compiler$FnMethod parse "Compiler.java" 5471]
[clojure.lang.Compiler$FnExpr parse "Compiler.java" 4033]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 7109]
[clojure.lang.Compiler analyze "Compiler.java" 6793]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 7099]
[clojure.lang.Compiler analyze "Compiler.java" 6793]
[clojure.lang.Compiler access$300 "Compiler.java" 38]
[clojure.lang.Compiler$DefExpr$Parser parse "Compiler.java" 596]
[clojure.lang.Compiler analyzeSeq "Compiler.java" 7111]
[clojure.lang.Compiler analyze "Compiler.java" 6793]
[clojure.lang.Compiler analyze "Compiler.java" 6749]
[clojure.lang.Compiler compile1 "Compiler.java" 7730]
[clojure.lang.Compiler compile1 "Compiler.java" 7725]
[clojure.lang.Compiler compile1 "Compiler.java" 7725]
[clojure.lang.Compiler compile "Compiler.java" 7802]
[clojure.lang.RT compile "RT.java" 411]
[clojure.lang.RT load "RT.java" 457]
[clojure.lang.RT load "RT.java" 424]
[clojure.core$load$fn__6856 invoke "core.clj" 6115]
[clojure.core$load invokeStatic "core.clj" 6114]
[clojure.core$load doInvoke "core.clj" 6098]
[clojure.lang.RestFn invoke "RestFn.java" 408]
[clojure.core$load_one invokeStatic "core.clj" 5897]
[clojure.core$compile$fn__6861 invoke "core.clj" 6125]
[clojure.core$compile invokeStatic "core.clj" 6125]
[user$eval5 invokeStatic "form-init10924602446184730501.clj" 1]
[user$eval5 invoke "form-init10924602446184730501.clj" 1]
[clojure.lang.Compiler eval "Compiler.java" 7181]
[clojure.lang.Compiler eval "Compiler.java" 7170]
[clojure.lang.Compiler eval "Compiler.java" 7171]
[clojure.lang.Compiler load "Compiler.java" 7640]
[clojure.lang.Compiler loadFile "Compiler.java" 7578]
[clojure.main$load_script invokeStatic "main.clj" 475]
[clojure.main$init_opt invokeStatic "main.clj" 477]
[clojure.main$init_opt invoke "main.clj" 477]
[clojure.main$initialize invokeStatic "main.clj" 508]
[clojure.main$null_opt invokeStatic "main.clj" 542]
[clojure.main$null_opt invoke "main.clj" 539]
[clojure.main$main invokeStatic "main.clj" 664]
[clojure.main$main doInvoke "main.clj" 616]
[clojure.lang.RestFn applyTo "RestFn.java" 137]
[clojure.lang.Var applyTo "Var.java" 705]
[clojure.main main "main.java" 40]],
:cause "leiningen.ring.war",
:phase :compile-syntax-check}}
from lein-ring.
Is it possible to provide a repository that replicates the error?
from lein-ring.
I'll see what I can do...Would a zipped project do, in case I'm not able to publish something online?
from lein-ring.
Yes, if you like you can send it directly to my email, [email protected]. Otherwise, if the problem can be replicated with a minimal project, then that would be fine, too.
from lein-ring.
Related Issues (20)
- tools.nrepl version added is very old HOT 7
- ensure-handler-set! incorrectly calls System/exit HOT 4
- lein ring server-headless custom-port doesn't works HOT 5
- 0.12.2 fails when compiling `:aot :all` HOT 5
- Looks like release 0.12.3 haven't actually been pushed to clojars HOT 2
- Was something package name changed? HOT 10
- :ring :nrepl :start? true injects [org.clojure/tools.nrepl "0.2.3"] which messes up CIDER, cider-nrepl and nREPL HOT 3
- Dependency `unify` broken with Clojure 1.10 HOT 5
- Problem passing jetty adapter options as :adapter map using ring by server-headless HOT 2
- CompilerError occured in Clojure1.10 HOT 1
- uberwar task fails with latest leiningen versions HOT 2
- Update ring-version to latest
- SslContextFactory$Server not found HOT 2
- how to set jvm-opts for ring task HOT 1
- :listener-class HOT 2
- :reload-paths equivalent for :auto-refresh? HOT 5
- Jar collision: duct/core VS ragtime/core HOT 15
- `destroy` VS `contextDestroyed` HOT 9
- Running lein ring server headless, ignores resources/log4j.properties HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lein-ring.