2014-06-18 13 views
0

Ring 위에 Aleph를 실행하고 피드백 루프를 단축하려면 lein ring server을 사용하려고합니다.NlePointerException - Lleing 서버가 Aleph + Ring에있는 경우

lein ring server을 호출 할 때 모든 것이 잘되는 것처럼 보이지만 URL을 브라우저로 지정하면 아래의 스택 추적을 사용하여 NullPointerException을 얻을 수 있습니다.

그러나 (al.app/start 3006)을 실행하면 NLP이 표시됩니다.

전체 프로젝트는 GitHub에 있습니다.

내가 뭘 잘못하고 있니?

core.clj:107 lamina.core/enqueue 
app.clj:39 al.app/hello-handler 
http.clj:79 aleph.http/wrap-aleph-handler[fn] 
response.clj:27 compojure.response/eval1328[fn] 
response.clj:10 compojure.response/eval1289[fn] 
core.clj:93 compojure.core/make-route[fn] 
core.clj:39 compojure.core/if-route[fn] 
...  

나는 알레프 0.3.2를 사용하고, 그 내 코드입니다 : 알레프는 비동기의 Netty 웹 서버를 사용하는 반면

(ns al.app 
    (:use 
     aleph.http 
     lamina.core 
     compojure.core 
     ring.middleware.keyword-params) 
(:require [compojure.route :as route])) 

(defn hello-handler                  
    "Our handler for the /hello path"              
    [ch request]                   
    (let [params (:route-params request)           
     name (params :name)]               
    (enqueue ch                   
     {:status 200                  
     :headers {}                  
     :body (str "Hello " name)})))             

(defroutes my-routes                 
    (GET ["/hello/:name", :name #"[a-zA-Z]+"] {} (wrap-aleph-handler hello-handler))  
    (route/not-found "Page not found"))             

(defn start                    
    "Start our server in the specified port"           
    [port]                    
    (start-http-server (wrap-ring-handler my-routes) {:port port})) 

답변

0

Lein 링 플러그인, 임베디드 Jetty 웹 서버를 사용합니다. aleph.http/wrap-aleph-handler 미들웨어는 aleph.http/start-http-server 기능으로 시작된 Netty 서버에서만 작동하도록 설계되었습니다.

+0

즉,'lein-ring' 플러그인을 해킹하지 않으면 불가능하다는 뜻입니까? – mjaskowski