$ lein new pedestal-service peddy
然后将以下文件添加到 immutant 文件夹
(ns immutant.init
(:require [immutant.web :as web]
[io.pedestal.http :as http]
[peddy.service :as app]))
(web/start-servlet "/" (::http/servlet (http/create-servlet app/service)))
在那之后
$ lein immutant deploy peddy
接着
$ lein immutant run
用 nrepl 声明的不变服务器
但是当我尝试在浏览器中打开页面时,它会抛出错误
我正在使用 immutant 1.1.4 和 pedestal-service 0.4.0
错误的堆栈跟踪
ERROR [io.pedestal.http.impl.servlet-interceptor] (http-/0.0.0.0:8080-1) {:line 293, :msg "error-stylobate triggered", :context {:io.pedestal.impl.interceptor/terminators (#<servlet_interceptor$terminator_inject$fn__11550 io.pedestal.http.impl.servlet_interceptor$terminator_inject$fn__11550@7681d2d5>), :io.pedestal.impl.interceptor/stack (#io.pedestal.interceptor.Interceptor{:name :io.pedestal.http.impl.servlet-interceptor/terminator-injector, :enter #<helpers$before$fn__9159 io.pedestal.interceptor.helpers$before$fn__9159@76b5905>, :leave nil, :error nil}), :io.pedestal.impl.interceptor/execution-id 1, :servlet #<FnServlet io.pedestal.http.servlet.FnServlet@4b4b3283>, :servlet-config #<Dynamic org.apache.catalina.core.StandardWrapperFacade$Dynamic@1e733d96>, :servlet-response #<ResponseFacade org.apache.catalina.connector.ResponseFacade@28a7423c>, :servlet-request #<RequestFacade org.apache.catalina.connector.RequestFacade@2f3f5533>}}: clojure.lang.ExceptionInfo: Interceptor Exception: No matching field found: getContentLengthLong for class org.apache.catalina.connector.RequestFacade {:execution-id 1, :stage :enter, :interceptor :io.pedestal.http.impl.servlet-interceptor/stylobate, :exception-type :java.lang.IllegalArgumentException, :exception #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: getContentLengthLong for class org.apache.catalina.connector.RequestFacade>}
at clojure.core$ex_info.invoke(core.clj:4403) [clojure-1.6.0.jar:]
at io.pedestal.impl.interceptor$throwable__GT_ex_info.invoke(interceptor.clj:37)
at io.pedestal.impl.interceptor$try_f.invoke(interceptor.clj:53)
at io.pedestal.impl.interceptor$enter_all_with_binding.invoke(interceptor.clj:140)
at io.pedestal.impl.interceptor$enter_all$fn__8979.invoke(interceptor.clj:156)
at clojure.lang.AFn.applyToHelper(AFn.java:152) [clojure-1.6.0.jar:]
at clojure.lang.AFn.applyTo(AFn.java:144) [clojure-1.6.0.jar:]
at clojure.core$apply.invoke(core.clj:624) [clojure-1.6.0.jar:]
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862) [clojure-1.6.0.jar:]
at clojure.lang.RestFn.invoke(RestFn.java:425) [clojure-1.6.0.jar:]
at io.pedestal.impl.interceptor$enter_all.invoke(interceptor.clj:154)
at io.pedestal.impl.interceptor$execute.invoke(interceptor.clj:272)
at io.pedestal.http.impl.servlet_interceptor$interceptor_service_fn$fn__11571.invoke(servlet_interceptor.clj:399)
at io.pedestal.http.servlet.FnServlet.service(servlet.clj:28)
at immutant.web.servlet.ServletProxy.service(servlet.clj:64)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.x.slim.incremental.18.jar:7.2.x.slim.incremental.18]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_45-internal]
Caused by: java.lang.IllegalArgumentException: No matching field found: getContentLengthLong for class org.apache.catalina.connector.RequestFacade
at clojure.lang.Reflector.getInstanceField(Reflector.java:271) [clojure-1.6.0.jar:]
at clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:315) [clojure-1.6.0.jar:]
at io.pedestal.http.impl.servlet_interceptor$add_content_length.invoke(servlet_interceptor.clj:206)
at io.pedestal.http.impl.servlet_interceptor$request_map.invoke(servlet_interceptor.clj:224)
at io.pedestal.http.impl.servlet_interceptor$enter_stylobate.invoke(servlet_interceptor.clj:255)
at io.pedestal.impl.interceptor$try_f.invoke(interceptor.clj:50)
... 25 more