2
votes

I am trying my first run with ring and lein, and I am facing problems in getting it to run. I have taken this example from the book "Web development with Clojure", chapter 1, and also from https://quickleft.com/blog/your-first-clojure-web-app/ . The code from both these sites give me the same error - Class Not Found.

I have the following project.clj

(defproject myfirstwebapp "0.1.1"
   :description "A hello world for a Ring based web app"
   :dependencies [[org.clojure/clojure "1.8.0"]
             [ring "1.4.0"]]
   :plugins [[lein-ring "0.9.7"]]
   :dev-dependencies [[lein-ring "0.9.7"]]
   :ring {:handler myfirstwebapp.core/app})

And the following core.clj

(ns myfirstwebapp.core)
(defn app [req]
  {:status 200
   :headers {"content-Type" "text/html"}
   :body "Hello World!"})

And the commands I ran were these:

lein new myfirstwebapp
edit project.clj as above
cd myfirstwebapp
lein deps
edit src/myfirstwebapp/core.clj as above
lein ring server

And now I am getting errors like:

Exception in thread "main" java.lang.ClassNotFoundException: leiningen.core.project$reduce_repo_step, compiling:(C:\Users\ROG\form-init7789757414629005682.clj:1:17608)

Is there some mismatch between the versions of different components that I am using? Or something else?

1
Initially I suspected it could be a localhost problem on my windows-7. So I turned it on using the suggestion from stackoverflow/24340450. But I still get the class not found error.R71
what version of lein are you running?DanLebrero
lein 2.6.0. Also, I suspected that maybe my java is not compatible, so I moved from java6 to java7u79. Same error.R71
the string "Hello World! is missing the closing quote. Is that a paste error?DanLebrero
Thanks. Yes, there was also a missing quote in the string. Fixed it.R71

1 Answers

1
votes