In some cases, “lein repl” will fail with “java.lang.ClassNotFoundException: org.codehaus.jackson.JsonFactory”. I have solved this problem, at least for my project. Read here why.
As I wrote before, I am currently learning clojure, and so I implement a simple web applicatoin. I build and run this application using Leiningen. There I encountered a problem: When I run
> lein clean > lein run
…and then try to launch a repl, it fails with
> lein repl Compiling newsreader.server Exception in thread "main" java.lang.ExceptionInInitializerError, compiling:(clutch.clj:1) ... A very long stack trace ... Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.JsonFactory at java.net.URLClassLoader$1.run(Unknown Source) ... more stack trace elements ...
This seems to be caused by a known problem in leinignen. Anyway, I want to run the server AND the REPL. I recognized that, when I run
> lein clean > lein repl
the REPL will work fine, but the server won’t start anymore. The solution - at least in my case - is quite simple: Start the server from the REPL:
> lein repl Compiling newsreader.server ... more output from the REPL ... newsreader.server=> (-main) Starting server... 2012-11-14 09:44:25.918:INFO::Logging to STDERR via org.mortbay.log.StdErrLog Server started on port [8080]. You can view the site at http://localhost:8080 #<Server Server@f6dd4> newsreader.server=> 2012-11-14 09:44:25.919:INFO::jetty-6.1.25 2012-11-14 09:44:25.938:INFO::Started SocketConnector@0.0.0.0:8080 newsreader.server=> (+ 2 3) 5 newsreader.server=>
And this works really well for me. Now, if only SublimeREPL would already work with leiningen2…
You might also be interested in...
- OpenID in a clojure web application using openid4java How to use openid4java in a clojure application.
- Software Quality for Developers Learn about software quality, TDD, ... in this 6-part video course.