weavejester / compojure

A concise routing library for Ring/Clojure
Eclipse Public License 1.0
4.09k stars 256 forks source link

No such var: response/url-response on versions above 1.1.9 #126

Closed conan closed 9 years ago

conan commented 9 years ago

Sorry for the long output in this post. If I try to use compojure above version 1.1.9 I get the following error (my lein deps :tree is below):

Exception in thread "main" java.lang.RuntimeException: No such var: response/url-response, compiling:(compojure/response.clj:49:9)
    at clojure.lang.Compiler.analyze(Compiler.java:6380)
    at clojure.lang.Compiler.analyze(Compiler.java:6322)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3573)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6562)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.analyze(Compiler.java:6322)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3624)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6562)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.analyze(Compiler.java:6322)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5708)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5139)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3751)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6558)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.analyze(Compiler.java:6322)
    at clojure.lang.Compiler$MapExpr.parse(Compiler.java:2879)
    at clojure.lang.Compiler.analyze(Compiler.java:6369)
    at clojure.lang.Compiler.analyze(Compiler.java:6322)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3624)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6562)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.analyze(Compiler.java:6322)
    at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5708)
    at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5139)
    at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3751)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:6558)
    at clojure.lang.Compiler.analyze(Compiler.java:6361)
    at clojure.lang.Compiler.eval(Compiler.java:6616)
    at clojure.lang.Compiler.eval(Compiler.java:6608)
    at clojure.lang.Compiler.load(Compiler.java:7064)
    at clojure.lang.RT.loadResourceScript(RT.java:370)
    at clojure.lang.RT.loadResourceScript(RT.java:361)
    at clojure.lang.RT.load(RT.java:440)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5018.invoke(core.clj:5530)
    at clojure.core$load.doInvoke(core.clj:5529)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5336)
    at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
    at clojure.core$load_lib.doInvoke(core.clj:5374)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$load_libs.doInvoke(core.clj:5413)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$require.doInvoke(core.clj:5496)
    at clojure.lang.RestFn.invoke(RestFn.java:482)
    at compojure.core$eval1090$loading__4910__auto____1091.invoke(core.clj:1)
    at compojure.core$eval1090.invoke(core.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6619)
    at clojure.lang.Compiler.eval(Compiler.java:6608)
    at clojure.lang.Compiler.load(Compiler.java:7064)
    at clojure.lang.RT.loadResourceScript(RT.java:370)
    at clojure.lang.RT.loadResourceScript(RT.java:361)
    at clojure.lang.RT.load(RT.java:440)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5018.invoke(core.clj:5530)
    at clojure.core$load.doInvoke(core.clj:5529)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5336)
    at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
    at clojure.core$load_lib.doInvoke(core.clj:5374)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$load_libs.doInvoke(core.clj:5413)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:621)
    at clojure.core$use.doInvoke(core.clj:5507)
    at clojure.lang.RestFn.invoke(RestFn.java:436)
    at ring.middleware.refresh$eval1084$loading__4910__auto____1085.invoke(refresh.clj:1)
    at ring.middleware.refresh$eval1084.invoke(refresh.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6619)
    at clojure.lang.Compiler.eval(Compiler.java:6608)
    at clojure.lang.Compiler.load(Compiler.java:7064)
    at clojure.lang.RT.loadResourceScript(RT.java:370)
    at clojure.lang.RT.loadResourceScript(RT.java:361)
    at clojure.lang.RT.load(RT.java:440)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5018.invoke(core.clj:5530)
    at clojure.core$load.doInvoke(core.clj:5529)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5336)
    at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
    at clojure.core$load_lib.doInvoke(core.clj:5374)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$load_libs.doInvoke(core.clj:5413)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:621)
    at clojure.core$use.doInvoke(core.clj:5507)
    at clojure.lang.RestFn.invoke(RestFn.java:512)
    at ring.server.standalone$eval17$loading__4910__auto____18.invoke(standalone.clj:1)
    at ring.server.standalone$eval17.invoke(standalone.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6619)
    at clojure.lang.Compiler.eval(Compiler.java:6608)
    at clojure.lang.Compiler.load(Compiler.java:7064)
    at clojure.lang.RT.loadResourceScript(RT.java:370)
    at clojure.lang.RT.loadResourceScript(RT.java:361)
    at clojure.lang.RT.load(RT.java:440)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5018.invoke(core.clj:5530)
    at clojure.core$load.doInvoke(core.clj:5529)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5336)
    at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
    at clojure.core$load_lib.doInvoke(core.clj:5374)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$load_libs.doInvoke(core.clj:5413)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$require.doInvoke(core.clj:5496)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at ring.server.leiningen$eval11$loading__4910__auto____12.invoke(leiningen.clj:1)
    at ring.server.leiningen$eval11.invoke(leiningen.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6619)
    at clojure.lang.Compiler.eval(Compiler.java:6608)
    at clojure.lang.Compiler.load(Compiler.java:7064)
    at clojure.lang.RT.loadResourceScript(RT.java:370)
    at clojure.lang.RT.loadResourceScript(RT.java:361)
    at clojure.lang.RT.load(RT.java:440)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5018.invoke(core.clj:5530)
    at clojure.core$load.doInvoke(core.clj:5529)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5336)
    at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
    at clojure.core$load_lib.doInvoke(core.clj:5374)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$load_libs.doInvoke(core.clj:5413)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$require.doInvoke(core.clj:5496)
    at clojure.lang.RestFn.invoke(RestFn.java:436)
    at user$eval7.invoke(form-init5370647669938403443.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6619)
    at clojure.lang.Compiler.eval(Compiler.java:6608)
    at clojure.lang.Compiler.load(Compiler.java:7064)
    at clojure.lang.Compiler.loadFile(Compiler.java:7020)
    at clojure.main$load_script.invoke(main.clj:294)
    at clojure.main$init_opt.invoke(main.clj:299)
    at clojure.main$initialize.invoke(main.clj:327)
    at clojure.main$null_opt.invoke(main.clj:362)
    at clojure.main$main.doInvoke(main.clj:440)
    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.RuntimeException: No such var: response/url-response
    at clojure.lang.Util.runtimeException(Util.java:219)
    at clojure.lang.Compiler.resolveIn(Compiler.java:6848)
    at clojure.lang.Compiler.resolve(Compiler.java:6818)
    at clojure.lang.Compiler.analyzeSymbol(Compiler.java:6779)
    at clojure.lang.Compiler.analyze(Compiler.java:6343)
    ... 154 more

Here's my lein deps :tree:

 [circuit-breaker "0.1.7"]
   [slingshot "0.10.3"]
 [clj-http "1.0.1" :exclusions [[com.fasterxml.jackson.core/jackson-core] [com.googlecode.json-simple/json-simple]]]
   [cheshire "5.3.1" :exclusions [[org.clojure/clojure]]]
     [com.fasterxml.jackson.dataformat/jackson-dataformat-smile "2.3.1"]
     [tigris "0.1.1"]
   [com.cognitect/transit-clj "0.8.259" :exclusions [[org.clojure/clojure]]]
     [com.cognitect/transit-java "0.8.269"]
       [com.fasterxml.jackson.datatype/jackson-datatype-json-org "2.3.2"]
         [com.fasterxml.jackson.core/jackson-databind "2.3.2"]
           [com.fasterxml.jackson.core/jackson-annotations "2.3.0"]
         [org.json/json "20090211"]
       [org.apache.directory.studio/org.apache.commons.codec "1.8"]
       [org.msgpack/msgpack "0.6.10"]
         [org.javassist/javassist "3.18.1-GA"]
     [org.clojure/test.check "0.5.9"]
   [commons-codec "1.9" :exclusions [[org.clojure/clojure]]]
   [commons-io "2.4" :exclusions [[org.clojure/clojure]]]
   [crouton "0.1.2" :exclusions [[org.clojure/clojure]]]
     [org.jsoup/jsoup "1.7.1"]
   [org.apache.httpcomponents/httpclient "4.3.5" :exclusions [[org.clojure/clojure]]]
     [commons-logging "1.1.3"]
   [org.apache.httpcomponents/httpcore "4.3.3" :exclusions [[org.clojure/clojure]]]
   [org.apache.httpcomponents/httpmime "4.3.5" :exclusions [[org.clojure/clojure]]]
   [org.clojure/tools.reader "0.8.10" :exclusions [[org.clojure/clojure]]]
   [potemkin "0.3.8" :exclusions [[org.clojure/clojure]]]
     [clj-tuple "0.1.5"]
     [riddley "0.1.7"]
 [clj-time "0.6.0"]
   [joda-time "2.2"]
 [clojure-complete "0.2.3" :scope "test" :exclusions [[org.clojure/clojure]]]
 [com.newrelic.agent.java/newrelic-api "3.12.0"]
 [com.novemberain/langohr "2.11.0"]
   [clojurewerkz/support "0.20.0"]
     [com.google.guava/guava "14.0.1"]
   [com.rabbitmq/amqp-client "3.3.1"]
 [compojure "1.2.1"]
   [clout "2.0.0"]
     [instaparse "1.3.4" :exclusions [[org.clojure/clojure]]]
   [medley "0.5.3"]
   [org.clojure/tools.macro "0.1.5"]
   [ring/ring-codec "1.0.0"]
 [conf-er "1.0.1"]
 [criterium "0.4.3"]
 [http-kit "2.1.19"]
 [log4j "1.2.17" :exclusions [[javax.mail/mail] [javax.jms/jms] [com.sun.jdmk/jmxtools] [com.sun.jmx/jmxri]]]
 [midje "1.6.3" :scope "test"]
   [colorize "0.1.1" :scope "test" :exclusions [[org.clojure/clojure]]]
   [dynapath "0.2.0" :scope "test"]
   [gui-diff "0.5.0" :scope "test"]
     [org.clojars.trptcolin/sjacket "0.1.3" :scope "test" :exclusions [[org.clojure/clojure]]]
       [net.cgrand/parsley "0.9.1" :scope "test"]
       [net.cgrand/regex "1.1.0" :scope "test"]
   [ordered "1.2.0" :scope "test" :exclusions [[org.clojure/clojure]]]
   [org.clojure/core.unify "0.5.2" :scope "test" :exclusions [[org.clojure/clojure]]]
   [org.clojure/math.combinatorics "0.0.7" :scope "test"]
   [org.clojure/tools.namespace "0.2.4" :scope "test"]
   [swiss-arrows "1.0.0" :scope "test"]
   [utilize "0.2.3" :scope "test" :exclusions [[org.clojure/clojure]]]
 [net.mikera/imagez "0.5.0"]
   [com.jhlabs/filters "2.0.235-1"]
   [net.mikera/clojure-utils "0.6.1"]
   [net.mikera/mathz "0.3.0"]
   [net.mikera/mikera-gui "0.3.1"]
   [net.mikera/randomz "0.3.0"]
   [org.imgscalr/imgscalr-lib "4.2"]
 [org.clojure/clojure-contrib "1.2.0"]
 [org.clojure/clojure "1.6.0"]
 [org.clojure/tools.logging "0.2.6"]
 [org.clojure/tools.nrepl "0.2.6" :scope "test" :exclusions [[org.clojure/clojure]]]
 [org.eclipse.jetty/jetty-jmx "7.6.8.v20121106" :exclusions [[org.eclipse.jetty/jetty-util]]]
 [org.graylog2/gelfj "1.1.4"]
   [com.googlecode.json-simple/json-simple "1.1"]
 [platform-tools "1.0.1-20141112.154312-15"]
   [org.clojure/data.codec "0.1.0"]
 [prismatic/hiphip "0.2.0"]
 [ring/ring-core "1.3.1"]
   [commons-fileupload "1.3"]
   [crypto-equality "1.0.0"]
   [crypto-random "1.2.0"]
 [ring/ring-jetty-adapter "1.3.1"]
   [org.eclipse.jetty/jetty-server "7.6.13.v20130916"]
     [org.eclipse.jetty.orbit/javax.servlet "2.5.0.v201103041518"]
     [org.eclipse.jetty/jetty-continuation "7.6.13.v20130916"]
     [org.eclipse.jetty/jetty-http "7.6.13.v20130916"]
       [org.eclipse.jetty/jetty-io "7.6.13.v20130916"]
         [org.eclipse.jetty/jetty-util "7.6.13.v20130916"]
   [ring/ring-servlet "1.3.1"]

I've tried playing around with all the ring versions and have added exclusions everywhere, but can't figure out how to get rid of this problem. It's fine on 1.1.9, but is broken on 1.2.0 and 1.2.1.

weavejester commented 9 years ago

It's likely that you have an old class files somewhere on your classpath that's causing issues.

The first thing to do is to run lein clean. That will wipe your target directory, and in most cases solves issues like these.

If it doesn't, then you probably have a bad dependency, either from your project.clj file, or as a plugin via your profiles.clj file. This dependency will contain compiled class files, including ones from Compojure, that will override Compojure's source files.

You can find a bad dependency through trial and error. Remove plugins and dependencies until it works.

conan commented 9 years ago

Hmm, OK thanks - I'll let you know how I go. I've done quite a lot of cleaning already, but haven't been through the dependency list.

pjlegato commented 9 years ago

I was experiencing a similar issue with:

Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'compojure.core/wrap-context

I found that lein clean and even finding the offending dependency were insufficient; I had to rm -rf $PROJECT_DIR/target manually. After that, it worked with Compojure 1.2.1.

conan commented 9 years ago

Right, after an extensive commenting session it turned out to be a transitive dependency pulled in by one of our other projects; turns out I don't understand how transitive dependencies work in Leiningen, but for anyone reading this in the future, it's not like Maven - the nearest dependency doesn't necessarily win. Thanks for the help, this wasn't a compojure issue.