1

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ますか?

4

1 に答える 1

2

このエラーは通常、テンプレート ファイルが見つからない場合に発生します。では、ディレクトリまたはディレクトリtemplates/index.html内を探しています。resources/templatessrc/templates

于 2013-09-17T22:35:59.680 に答える