2013-04-08 2 views
2

저는 clojure로 시작했으며 작은 웹 앱을 만들려고합니다. 딸꾹질을 시도하고 싶었지만 작동하지 않는 것 같습니다. 내 코드는 아래와 같습니다. 내가 할딸꾹질이 작동하지 않습니다 : FileNotFoundException : 클래스 경로에서 ../as__init.class 또는 ../as.clj를 찾을 수 없습니다.

Project.clj

(defproject WebTest "0.1.0-SNAPSHOT" 
    :description "FIXME: write description" 
    :url "http://example.com/FIXME" 
    :dependencies [[org.clojure/clojure "1.4.0"] 
       [compojure "1.1.5"] 
       [hiccup "1.0.3"] 
       [org.clojure/java.jdbc "0.2.3"] 
       [net.sourceforge.jtds/jtds "1.2.4"] 
       ] 
    :plugins [[lein-ring "0.8.2"] 
      [lein-idea "1.0.1"]] 
    :ring {:handler WebTest.handler/app} 
    :profiles 
    {:dev {:dependencies [[ring-mock "0.1.3"]]}}) 

(ns WebTest.handler 
    (:use compojure.core) 
    (:require [compojure.handler :as handler] 
      [compojure.route :as route] 
      [WebTest.Content :as pages] 
      [hiccup.core :as templ])) 

(defroutes app-routes 
    (GET "/" [] (templ/html [h1 "Hello world"])) 
    (GET "/Greeting/:name" [name] (str "<h1>Hello " name "</h1>")) 
    (GET "/Date/:year/:month/:day" [year month day] (str "<h1>It is " month "/" day "/" year "</h1>")) 
    (route/not-found "Not Found")) 

(def app 
    (handler/site app-routes)) 

handler.clj

그리고 오류가 매우 긴 스택 트레이스는 그 다음

Exception in thread "main" java.io.FileNotFoundException: Could not locate hiccu 
p/core/as__init.class or hiccup/core/as.clj on classpath: 
     at clojure.lang.RT.load(RT.java:432) 
     at clojure.lang.RT.load(RT.java:400) 
     at clojure.core$load$fn__4890.invoke(core.clj:5415) 
     at clojure.core$load.doInvoke(core.clj:5414) 

입니다. 내가 뭘 잘못하고 있는지에 대한 통찰력? 나머지는 잘 작동하지만 당신은 내가 제거하면, 나 실패처럼 WebTest.Content을 요구하려고

답변

3

일이 :

(ns WebTest.handler 
    (:use compojure.core) 
    (:require [compojure.handler :as handler] 
      [compojure.route :as route] 
      ;[WebTest.Content :as pages] 
      [hiccup.core :as templ])) 

당신이 경우 것이다 언급 오류가있는 경우 어디에 일치하지 않는 []의에서 the : handler.clj의 ns 형태의 섹션이 필요합니다.

+0

실제로 사용되지 않은 다른 파일에 대한 참조입니다. 나는 그것을 제거하고 나는 여전히 같은 오류가 발생합니다. –

+2

Arthur에 동의해야합니다. Clojure는 hiccup.core 네임 스페이스에서 "as"파일을 찾으려고합니다. 이렇게하면 ":"이 키워드 앞에 누락되었다고 생각하게됩니다. – Mike

+0

좋아, 나는 맨 아래에서 맨 위로 옮기고 작업을 시작했다. 그리고 바닥으로 내려가도 여전히 효과가 있습니다. 그게 왜 도움이 될지 모르겠다. ( –