【发布时间】:2013-09-18 06:36:48
【问题描述】:
我从https://github.com/cgrand/enlive 复制了一个非常基本的示例,但它无法编译:
(ns web.handler
(:require
[compojure.core :refer :all]
[compojure.handler]
[compojure.route :as route]
[net.cgrand.enlive-html :as html]))
;; Compiler throws in the next line, see the message below.
(html/deftemplate main-template "templates/index.html"
[]
[:head :title] (html/content "Enlive starter kit"))
(defroutes app-routes
(GET "/" [] "Hello")
(GET "/ping/:what" [what] (str "<h1>Ping '" what "'</h1>"))
(route/resources "/")
(route/not-found "Not Found"))
(def app
(compojure.handler/site app-routes))
我得到的错误:
java.lang.NullPointerException, compiling:(handler.clj:9:1)
我用命令运行:
lein ring server-headless
如何让它发挥作用?
编辑
到目前为止我的调查:来自enlive-html.clj:54 的错误抛出:
(defn tagsoup-parser
"Loads and parse an HTML resource and closes the stream."
[stream]
(filter map?
(with-open [^java.io.Closeable stream stream]
(xml/parse (org.xml.sax.InputSource. stream) startparse-tagsoup)))) ; #54
可能org.xml.sax 没有被引用?我如何使用lein 做到这一点?
【问题讨论】: