3
我執行lein uberwar
爲我的測試Web應用程序,我得到以下奇怪的錯誤:怪異雷音uberwar行爲
Exception in thread "main" java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.Symbol (servlet.clj:1)
的servlet.clj包含以下內容:
(ns test.servlet
(:use ring.util.servlet)
(:require test.routes :as routes)
(:gen-class :extends javax.servlet.http.HttpServlet))
(defservice routes/app-routes)
測試.routes文件包含:
(ns test.routes
(:use compojure.core)
(:require [compojure.route :as route]
[compojure.handler :as handler]))
(defroutes app-routes
(GET "/" [] {:status 200
:headers {"Content-Type" "text/html"}
:body "<h1>Hello World</h1>"})
(route/files "/" {:root "static"})
(ANY "/:s" [s] (str "page-not-found" s)
;; For lein ring-server
;(def test-handler
; (handler/site app-routes))
奇怪的是,如果我替換行
(:require test.routes :as routes)
有了:
(:require test.routes)
並調用
(defservice test.routes/app-routes)
在servlet.clj,戰爭編譯罰款,它是在Tomcat的工作完美無缺。我的代碼中是否存在一些我無法看到的錯誤?爲什麼我需要調用test.routes/...而不是僅僅路由/ ...?
多麼愚蠢的我,謝謝。 – kliron 2011-06-06 12:40:54
@stk歡迎您!你是否介意接受這個答案,如果它解決了你的問題? – ponzao 2011-06-07 10:32:23
對不起,花了這麼長時間 – kliron 2011-06-20 07:42:51