Upgrading to 1.1.6 from 1.1.5 results in HttpServletRequest not found

657 views
Skip to first unread message

Colin Yates

unread,
Feb 13, 2014, 6:53:27 AM2/13/14
to comp...@googlegroups.com
Hi all,

My test suite passes with 1.1.5 but when I upgrade to 1.1.6 it fails stating that it can't find HttpServletRequest on the classpath.  Has the servlet-api been removed from Compojure or one of its transient dependencies between 1.1.5 and 1.1.6?

The actual place that fails is "ring/middleware/multipart_params.clj:39:5".

The only change I make is changing 1.1.5 to 1.1.6.  Before I go hunting around midje I just want to make sure I am not being a numpty...

Here is my project.clj for reference:

[code]
(defproject XX/YY "0.1.0-SNAPSHOT"
  :description "XX"
  :url "XX"
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [compojure "1.1.6"]
                 [ring/ring-json "0.2.0"]
                 [hiccup "1.0.5"]
                 [clj-time "0.6.0"]
                 ;; do not upgrade to jdbc 0.3.x as it has removed some
                 ;; functions that we use
                 [org.clojure/java.jdbc "0.3.0-alpha4"]
                 ;; do not upgrade jtds until everything uses jdk 1.7
                 [net.sourceforge.jtds/jtds "1.2.7"]
                 [com.mchange/c3p0 "0.9.2.1"]
                 [environ "0.4.0"]
                 [org.clojure/tools.logging "0.2.6"]
                 [ch.qos.logback/logback-classic "1.1.1"]
                 [honeysql "0.4.3"]
                 [clj-http "0.7.9"]
                 [org.apache.poi/poi "3.9"]
                 [org.apache.poi/poi-scratchpad "3.9"]
                 ;; needed for those using commons logging
[org.slf4j/jcl-over-slf4j "1.7.6"]]
  ;; exclude commons-logging as it causes classpath issues because it isn't set up correctly.
  ;; it is pulled in by clj-http but it is excluded here for safety.
  :exclusions [commons-logging/commons-logging]
  :plugins [[lein-ring "0.8.0"]
            [lein-marginalia "0.7.1"]
            [lein-shell "0.2.0"]
            [lein-cucumber "1.0.2"]
            [lein-midje "3.0.0"]
            [lein-deps-tree "0.1.2"]
            [lein-environ "0.4.0"]
            [lein-ancient "0.5.4"]]
  :ring {:handler health.handler/app}
  :profiles
  {:dev {:dependencies [[ring-mock "0.1.5"]
                        [midje "1.6.2"]
                        [org.clojure/tools.trace "0.7.6"]
                        [hsqldb/hsqldb "1.8.0.10"]]         
         :env {:analytocs-skip-populating-date-dimension-tables true}}}  
  :cucumber-feature-paths ["test/features/"]
  :aliases {"cucumber!" ["cucumber" "-f" "json:target/cucumber-test-report.json" "-f" "junit:target/cucumber-test-report.xml" "-f" "pretty"]
            "phantomjs!" ["shell" "phantomjs" "resources/public/lib/run-jasmine-1.9.1.js" "resources/public/test.html"]
            "war!" ["ring" "uberwar" "health.war"]
            "web!" ["with-profile" "web" "ring" "server-headless"]
            ;; run all the tests (except for cucumber as it isn't used yet)
            "all-tests!" ["do" "midje" ":config" "jenkins-midje.clj," "phantomjs!"]
            "marg!" ["do" "marg" "-d" "target/doc"]
            "full-build!" ["do" "clean," "all-tests!," "war!," "marg!"]})
[/code]

Colin Yates

unread,
Feb 13, 2014, 6:54:47 AM2/13/14
to comp...@googlegroups.com
Here is the full stack trace:

[code]
Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest, compiling:(ring/middleware/multipart_params.clj:39:5)
  at clojure.lang.Compiler.analyzeSeq(Compiler.java:6567)
  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$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.analyzeSeq(Compiler.java:6548)
  at clojure.lang.Compiler.analyze(Compiler.java:6361)
  at clojure.lang.Compiler.access$100(Compiler.java:37)
  at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:529)
  at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
  at clojure.lang.Compiler.analyze(Compiler.java:6361)
  at clojure.lang.Compiler.analyze(Compiler.java:6322)
  at clojure.lang.Compiler.eval(Compiler.java:6623)
  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:5417)
  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:408)
  at compojure.handler$eval16987$loading__4910__auto____16988.invoke(handler.clj:1)
  at compojure.handler$eval16987.invoke(handler.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:1789)
  at health.handler$eval16100$loading__4910__auto____16101.invoke(handler.clj:1)
  at health.handler$eval16100.invoke(handler.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:421)
  at midje.repl$load_facts$fn__7965.invoke(repl.clj:206)
  at midje.repl$load_facts.doInvoke(repl.clj:192)
  at clojure.lang.RestFn.invoke(RestFn.java:397)
  at user$eval8028.invoke(form-init440287721973492339.clj:1)
  at clojure.lang.Compiler.eval(Compiler.java:6619)
  at clojure.lang.Compiler.eval(Compiler.java:6609)
  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.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
  at java.lang.Class.getDeclaredMethods0(Native Method)
  at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
  at java.lang.Class.privateGetPublicMethods(Class.java:2651)
  at java.lang.Class.privateGetPublicMethods(Class.java:2667)
  at java.lang.Class.getMethods(Class.java:1467)
  at clojure.lang.Reflector.getMethods(Reflector.java:357)
  at clojure.lang.Compiler$InstanceMethodExpr.<init>(Compiler.java:1395)
  at clojure.lang.Compiler$HostExpr$Parser.parse(Compiler.java:952)
  at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
  ... 101 more
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest
  at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
  ... 110 more
[/code]

Curtis Summers

unread,
Feb 13, 2014, 7:15:16 AM2/13/14
to comp...@googlegroups.com
Looks similar to this bug:


Does adding [ring "1.2.1"] to your dependencies resolve it?

Curtis




--
You received this message because you are subscribed to the Google Groups "Compojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to compojure+...@googlegroups.com.
To post to this group, send email to comp...@googlegroups.com.
Visit this group at http://groups.google.com/group/compojure.
For more options, visit https://groups.google.com/groups/opt_out.

Curtis Summers

unread,
Feb 13, 2014, 7:25:08 AM2/13/14
to comp...@googlegroups.com
Ah, also see the Upgrade Notice section on ring's README:


compojure uses ring/ring-core, so if you would prefer not to reference [ring "1.2.1"] in your dependencies, then you need [javax.servlet/servlet-api "2.5"] in your dev dependencies instead.  Ugh.

Curtis

James Reeves

unread,
Feb 13, 2014, 7:38:47 AM2/13/14
to Compojure
Adding a reference to the servlet-api is, unfortunately, the correct solution.

Ring 1.3.0 won't have these issues, as the multipart middleware is being rewritten.

- James

Colin Yates

unread,
Feb 13, 2014, 7:44:09 AM2/13/14
to comp...@googlegroups.com, ja...@booleanknot.com
Thanks both.

James - would you mind documenting this on your front page as this was a stumbling block for me and expect it will be for many others.
Reply all
Reply to author
Forward
0 new messages