Clojure Clostache错误 - 没有实现方法::make-reader的协议:#'clojure.java.io / IOFactory found for class:nil [英] Clojure Clostache error - No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil

查看:115
本文介绍了Clojure Clostache错误 - 没有实现方法::make-reader的协议:#'clojure.java.io / IOFactory found for class:nil的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Am using clojure - 1.5.1,compojure - 1.1.5,clostache - 1.3.1。

Am using clojure - 1.5.1, compojure - 1.1.5, clostache - 1.3.1.

模板文件位于resources / public / templates文件夹下。

The template file is present under resources/public/templates folder.

代码:

(:require [clostache.parser :as cp])

(cp/render-resource "templates/connectionDetails.mustache" {:jmsConnectionName "Michael" :rest-conn-names ["a" "b"]}))


$ b b

Clostache的render-resource调用抛出以下异常:

The call to Clostache's render-resource is throwing the below 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


推荐答案

您的模板应位于源文件夹下。
在你的情况下:

Your templates should be located under the source folder. In your case that would be:

src
|
- templates
  |
  - connectionDetails.mustache

公用文件夹用于从Web应用程序提取的HTML资源客户端,即CSS,图像,Javascript等...

The public folder is used for HTML resources pulled from the web application client, i.e CSS, Images, Javascripts etc ...

Clostache正在查找你的类路径(即src文件夹)来找到它需要的文件。

Clostache is looking at your classpath (i.e src folder) to find the files it needs.

这篇关于Clojure Clostache错误 - 没有实现方法::make-reader的协议:#'clojure.java.io / IOFactory found for class:nil的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆