lein ring server giving Compiler exception

67 Views Asked by At

I am reading "Living Clojure" (2014) book and it has a project called cheshire-cat. My project.clj file is following:

(defproject cheshire-cat "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :min-lein-version "2.0.0"
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [compojure "1.3.1"]
                 [ring/ring-defaults "0.1.2"]
                 [ring/ring-json "0.3.1"]
                 [org.clojure/clojurescript "0.0-2371"]
                 [cljs-http "0.1.18"]
                 [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                 [enfocus "2.1.0"]
                 [javax.xml.bind/jaxb-api "2.3.1"]]
  :plugins [[lein-ring "0.8.13"]
            [lein-cljsbuild "1.0.3"]]
  :ring {:handler cheshire-cat.core.handler/app}
  :profiles
  {:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
                        [ring-mock "0.1.5"]]}}
  :cljsbuild {
    :builds [{
      :source-paths ["src-cljs"]
      :compiler {
        :output-to "resources/public/main.js"
        :optimizations :whitespace
        :pretty-print true}}]})

When I try to start the ring server with $lein ring server command, it gives the compiler exception error: https://pastebin.com/xJmVrJqa

How to make the ring server command work without error?

1

There are 1 best solutions below

0
Eugene Pakhomov On

Seems like you're hitting this issue: https://github.com/metosin/compojure-api/issues/426

Which apparently got fixed by this commit: https://github.com/metosin/compojure-api-template/pull/7/files

So I'd try updating the org.clojure/clojure version in project.clj. If that doesn't work, try other dependencies as well. Specifically compojure and lein-ring. But before updating any dependency, check its changelog to see if you also have to modify the code somewhat to accommodate the newer version.

Usually, such things don't happen in the Clojure world. But in this case, judging by that commit description, it seems like Leiningen has broken some backward compatibility at some point.