异常-----Template user.ftl not found
freemarker
1、错误描述
java.io.FileNotFoundException: Template user.ftl not found.
at freemarker.template.Configuration.getTemplate(Configuration.java:580)
at freemarker.template.Configuration.getTemplate(Configuration.java:543)
at com.you.freemarker.FreemarkerTemplate.getTemplate(FreemarkerTemplate.java:50)
at com.you.freemarker.FreemarkerTemplate.printFtl(FreemarkerTemplate.java:74)
at com.you.test.freemarker.FreemarkerTest.testFreemarker(FreemarkerTest.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

2、错误原因
freemarker和ftl虽然在同一目录级别下,但是没有正真指到该路径下,路径出现问题
//设置去哪里读取相应的ftl模板文件 conf.setClassForTemplateLoading(this.getClass(), "/ftl");
3、解决办法
修改路径
//设置去哪里读取相应的ftl模板文件 conf.setClassForTemplateLoading(this.getClass(), "/com/you/ftl");
异常-----Template user.ftl not found的更多相关文章
- cosbench 异常 FreeMarker template error: The following has evaluated to null or missing
问题现象: 使用Cosbench 0.4.2.c4 版本测试Ceph RGW read test失败,遇到异常如下: FreeMarker template error: The following ...
- Spring mvc 中使用ftl引用共通文件出错 FreeMarker template error: Error reading included file "/WEB-INF/ftl/common/errormessage.ftl"
初次接触spring mvc,想做一个小的练习项目,结果在ftl文件中引用其它的共通ftl文件时出错.
- [Freemarker] - 使用struts的component调用freemarker的ftl模板方法
struts中的component标签,可以用来调用freemarker的ftl模板文件,使用component标签传参可以这样写: 使用property方式写法: <s:component t ...
- 异常-----freemarker.core.ParseException: Token manager error
一,案例一 1.1.错误描述 freemarker.core.ParseException: Token manager error: freemarker.core.TokenMgrError: L ...
- MoreEffectiveC++Item35(异常)(条款9-15)
条款9 使用析构函数防止内存泄漏 条款10 在构造函数中防止内存泄漏 条款11 禁止异常信息传递到析构函数外 条款12 理解"抛出一个异常''与"传递一个参数"或调用一个 ...
- C++异常~二 转
Linux 下 C++ 异常处理技巧 处理固有语言局限性的四种技术 处理 C++ 中的异常会在语言级别上遇到少许隐含限制,但在某些情况下,您可以绕过它们.学习各种利用异常的方法,您就可以生产更可靠的应 ...
- Hexo - Template render error unexpected token
问题与分析 今天发现在使用hexo g时报错如下: FATAL Something's wrong. Maybe you can find the solution here: http://hexo ...
- Freemarker使用入门
一.概述: FreeMarker是一个模板引擎,一个基于模板生成文本输出的通用工具,使用纯Java编写 Template + data_model = output FreeMarker也是与Web容 ...
- struts2-ajax-jQuery
1.所需jar包如下所示.其中选中的四个包是struts2实现ajax所必需的,所有的jar包都可以从下载的完整的struts2 包中的lib文件夹中找到. 2.Demo struts2ajax.js ...
随机推荐
- BZOJ 1486: [HNOI2009]最小圈 [01分数规划]
裸题...平均权值最小的环.... 注意$dfs-spfa$时$dfs(cl)$...不要写成$dfs(u)$ #include <iostream> #include <cstdi ...
- for in 在数组和json中
数组中也有for--in,相较于对象中的用法是有区别的:数组中 var arr = ['曹操','曹植','曹丕'] for(i in arr){ console.log(i) //0 1 2 con ...
- SpringMVC之使用requestMapping映射请求、映射参数、映射头
1. 映射请求 作用:使用requestMapping可以指定处理器可以处理那些请求 地方:类和方法前面都可以 @requestMapping 类定义处: 提供初步的请求映射信息,相对于web应用的根 ...
- JDBC【数据库连接池、DbUtils框架、分页】
1.数据库连接池 什么是数据库连接池 简单来说:数据库连接池就是提供连接的... 为什么我们要使用数据库连接池 数据库的连接的建立和关闭是非常消耗资源的 频繁地打开.关闭连接造成系统性能低下 编写连接 ...
- ManagementObjectSearcher Path
为了获取硬件信息,你还需要创建一个ManagementObjectSearcher 对象.ManagementObjectSearcher searcher = new ManagementObjec ...
- POI导出多张图片到Excel
package com.sun.office.excel; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStr ...
- PHPUnit-附录 A. 断言 (assert)
[http://www.phpunit.cn/manual/5.7/zh_cn/appendixes.assertions.html] 本附录列举可用的各种断言方法. assertArrayHasKe ...
- IE8兼容问题总结---trim()方法
1.IE8不支持,jquery的trim()去空格的方法 错误表现 : 会报错,对象不支持此属性或方法; 解决办法 : 使用正则匹配空格 例如 : /^\s+|\s+$/greplace(/^\s+| ...
- 关于eclipse的mysql连接配置
打开eclipse,选择Window→Open Perspective→Other→Database Development,然后在右边的导航栏右键点击Database Connections文件夹, ...
- java中try catch块的使用
对于关流操作的时候,最好采用如下语句块: InputStream in=......; try{ try{ //some statemenet }finally{ //close stream in. ...