0

I've been trying to follow a number of tutorials on building a web app in Clojure, but I keep running into the same problem. To take the simplest case, I tried following this tutorial: http://drtom.ch/posts/2012-12-10/An_Introduction_to_Webprogramming_in_Clojure_-_Ring_and_Middleware/

When I get to the step that starts the server (run-jetty handler {:port 8383}), I get the following error:

NoSuchMethodError org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;[Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple; org.eclipse.jetty.util.log.JettyAwareLogger.log (JettyAwareLogger.java:613)

I asked lien to show me the classpath, and sure enough, org.slf4j.helpers.MessageFormatter isn't in there anywhere.

I've run into this on pretty much every ring-based web tutorial I've tried, so either I've got something configured weird (I updated and reinstalled lein, blew away my ~/.m2 and rebuilt, etc), or something has changed in the myriad dependencies that get put together to make the classpath.

Any ideas what's going on here?

EDIT

I've got further information -- I created a VM in virtualbox, installed OpenJDK and lein, and created a project there. It worked fine. Since I had created it in a directory shared with the host, I then tried doing "lein ring server" in the same directory from the host, and it failed with the above error.

So I did "lein classpath" both in the vm and in the host and compared the results -- they're identical. I also checked that they're running the same build of the same JVM (OpenJDK 64-bit build 24.51-b03).

So, if they're running the same JVM with identical classpaths, what's left?

scottb
  • 1,135
  • 11
  • 17
  • That tutorial is quite old. Have you tried this with a newer version of Clojure (e.g. 1.5.1 or higher) and a current version of Ring (e.g 1.2.2)? – Diego Basch May 17 '14 at 22:25
  • I've tried a half a dozen different tutorials for ring, luminus, compojure, noir, ... I keep running into the same problem. – scottb May 19 '14 at 13:53
  • Can you include your project.clj file to show the dependencies you are working with? – GregA100k May 20 '14 at 17:47
  • It's exactly the one from the tutorial I linked to... (defproject quickstart "1.0.0-SNAPSHOT" :description "FIXME: write description" :dependencies [[org.clojure/clojure "1.3.0"] [ring "1.1.5"]]) – scottb May 21 '14 at 17:57

1 Answers1

0

Can you try updating the dependencies like the following?

(defproject ..........
:dependencies [[org.clojure/clojure "1.5.1"]
         [ring/ring-core "1.1.8"]
         [ring/ring-jetty-adapter "1.1.8"]
         [compojure "1.1.3"]]
:main quickstart.core
:min-lein-version "2.0.0"
:plugins [[lein-ring "0.8.10"]]
:ring {:handler quickstart.core/handler})

If you use the lein ring plugin as configured above, you can start the application like:

lein ring server
lorthos
  • 437
  • 3
  • 9
  • Nope. Same error -- NoSuchMethodError on org.slf4j.helpers.MessageFormatter.arrayFormat. – scottb May 19 '14 at 13:52
  • Have you tried "lein clean" after changing the deps? Also would be good to start from a blank template created with "lein new". You can check out the dependencies of your project with "lein deps :tree" and see which slf4j version(s) are in the classpath – lorthos May 19 '14 at 16:17
  • I did try lein clean, and I tried it from a blank template, too. Same result. – scottb May 20 '14 at 15:54