[英]Clojure Clostache error - No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil
Am using clojure - 1.5.1, compojure - 1.1.5, clostache - 1.3.1. 我正在使用clojure-1.5.1,compojure-1.1.5,clostache-1.3.1。
The template file is present under resources/public/templates folder. 模板文件位于resources / public / templates文件夹下。
Code : 代码:
(:require [clostache.parser :as cp])
(cp/render-resource "templates/connectionDetails.mustache" {:jmsConnectionName "Michael" :rest-conn-names ["a" "b"]}))
The call to Clostache's render-resource is throwing the below Exception : 对Clostache的render-resource的调用引发以下Exception:
Exception: java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil
core_deftype.clj:541 clojure.core/-cache-protocol-fn
io.clj:73 clojure.java.io/fn[fn]
io.clj:106 clojure.java.io/reader
RestFn.java:410 clojure.lang.RestFn.invoke
AFn.java:161 clojure.lang.AFn.applyToHelper
RestFn.java:132 clojure.lang.RestFn.applyTo
core.clj:619 clojure.core/apply
core.clj:6278 clojure.core/slurp
RestFn.java:410 clojure.lang.RestFn.invoke
parser.clj:396 clostache.parser/render-resource
The resource is probably not found because your path seems to be incorrect. 找不到该资源,因为您的路径似乎不正确。 resources
is added to the classpath so to access your template you should use "public/templates/connectionDetails.mustache"
(it might not make sense to have the templates under public
if you do not expose them directly from your application). resources
会添加到类路径中,因此要访问您的模板,您应该使用"public/templates/connectionDetails.mustache"
(如果您不直接从应用程序中公开它们,则将模板置于public
可能没有任何意义)。
Your templates should be located under the source folder. 您的模板应位于源文件夹下。 In your case that would be: 您的情况是:
src
|
- templates
|
- connectionDetails.mustache
The public folder is used for HTML resources pulled from the web application client, ie CSS, Images, Javascripts etc ... 公用文件夹用于从Web应用程序客户端提取的HTML资源,即CSS,图像,Javascript等。
Clostache is looking at your classpath (ie src folder) to find the files it needs. Clostache正在查看您的类路径(即src文件夹)以查找所需的文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.