异常-----freemarker.core.ParseException: Token manager error
一,案例一
1.1、错误描述
freemarker.core.ParseException: Token manager error: freemarker.core.TokenMgrError: Lexical error at line 16, column 50. Encountered: "\uff01" (65281), after : "" in course.ftl at freemarker.template.Template.<init>(Template.java:174) at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:447) at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:360) at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:235) at freemarker.template.Configuration.getTemplate(Configuration.java:578) at freemarker.template.Configuration.getTemplate(Configuration.java:543) at com.you.freemarker.FreemarkerTemplate.getTemplate(FreemarkerTemplate.java:52) at com.you.freemarker.FreemarkerTemplate.printFtl(FreemarkerTemplate.java:76) at com.you.test.freemarker.FreemarkerTest.studentPrint(FreemarkerTest.java:142) at com.you.test.freemarker.FreemarkerTest.testCourse(FreemarkerTest.java:129) 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)
1.2、错误原因
"没有任何值存在"前多了一个空格
${(student.course.courseName)!"没有任何值存在"}
1.3、解决办法
"没有任何值存在"前面的空格去掉
${(student.course.courseName)!"没有任何值存在"}
二,案例二
2.1,错误描述
freemarker.core.ParseException: Token manager error: freemarker.core.TokenMgrError: Unknown directive: #list on line: 17, column: 61, in template: map.ftl in map.ftl at freemarker.template.Template.<init>(Template.java:174) at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:447) at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:360) at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:235) at freemarker.template.Configuration.getTemplate(Configuration.java:578) at freemarker.template.Configuration.getTemplate(Configuration.java:543) at com.you.freemarker.FreemarkerTemplate.getTemplate(FreemarkerTemplate.java:52) at com.you.freemarker.FreemarkerTemplate.printFtl(FreemarkerTemplate.java:76) at com.you.test.freemarker.FreemarkerTest.studentPrint(FreemarkerTest.java:210) at com.you.test.freemarker.FreemarkerTest.testMap(FreemarkerTest.java:197) 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.2,错误原因
结束标签书写不对
<#assign stu={"name":"zhangsan","age":"21","sex":"man"}> <#assign keys = stu?keys> <#list keys as key> ${key} = ${stu[key]}; <#list>
2.3,解决办法
正确写结束标签
<#assign stu={"name":"zhangsan","age":"21","sex":"man"}> <#assign keys = stu?keys> <#list keys as key> ${key} = ${stu[key]}; </#list>
就是不是<#list>而是</#list>
三,案例三
freemarker自定义标签
3.1、错误描述
freemarker.core.ParseException: Token manager error: freemarker.core.TokenMgrError: Unknown directive: #macro on line: 12, column: 101, in template: myself.ftl in myself.ftl at freemarker.template.Template.<init>(Template.java:174) at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:447) at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:360) at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:235) at freemarker.template.Configuration.getTemplate(Configuration.java:578) at freemarker.template.Configuration.getTemplate(Configuration.java:543) at com.you.freemarker.FreemarkerTemplate.getTemplate(FreemarkerTemplate.java:52) at com.you.freemarker.FreemarkerTemplate.printFtl(FreemarkerTemplate.java:76) at com.you.test.freemarker.FreemarkerTest.studentPrint(FreemarkerTest.java:217) at com.you.test.freemarker.FreemarkerTest.testMyself(FreemarkerTest.java:204) 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)
3.2,错误原因
<#--freemarker自定义标签--> <#macro write> ${repeat("张三丰",3)} <#macro>
3.3、解决办法
又犯了同样的错误,结束标签没有封口
<#--freemarker自定义标签--> <#macro write> ${repeat("张三丰",3)} </#macro>
异常-----freemarker.core.ParseException: Token manager error的更多相关文章
- 异常-----freemarker.core.ParseException: Encountered
1.错误描述 freemarker.core.ParseException: Encountered " " at line 14, column 12 in myself.ftl ...
- 异常-----freemarker.core.ParseException: Unexpected end of file reached
freemarker自定义标签 1.错误描述 freemarker.core.ParseException: Unexpected end of file reached. at freemarker ...
- 异常-----freemarker.core.ParseException: Encountered "string"
1.错误描述 freemarker.core.ParseException: Encountered "string" at line 21, column 21 in type. ...
- freemarker.core.ParseException:Unexpected end of file reached
1.错误原因 freemarker.core.ParseException:Unexpected end of file reached 2.错误原因 由于在宏定义中,运用组件时没有关闭标签,导致出错 ...
- 异常-----freemarker.core.InvalidReferenceException问题解决
案例一 1.1.错误描述 五月 28, 2014 9:56:48 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template ...
- 异常-----freemarker.core.NonStringException
一,案例一 1.1.错误描述 <html> <head> <meta http-equiv="content-type" content=" ...
- 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 ...
- 异常-----freemarker.template.TemplateException: Expected collection or sequence. datas evaluated instead to freemarker.core.HashLiteral$SequenceHash on line 7, column 18 in inc/select.ftl.
1.错误描述 六月 26, 2014 11:26:27 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template proc ...
- 异常-----freemarker.template.TemplateException: Error executing macro: write
freemarker自定义标签 1.错误描述 六月 05, 2014 11:31:35 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严 ...
随机推荐
- document.activeElement 过滤选择文件弹窗导致的页面失焦
在线考试页面,常常需要检测用户是否作弊. 一般是监听页面是否失焦的方式,而失焦的方式有很多种,比如QQ弹窗,切换页面,切换程序,input文件上传选择文件等 选择文件是正常情况,这种情况下需要过滤 本 ...
- 针对Eclipse的maven Missing artifact com.microsoft.sqlserver:slqjdbc4:jar:4.0
maven 中添加sqlserver 出错,报错内容 maven Missing artifact com.microsoft.sqlserver 解决方法这里先下载好jar包 ,然后maven命令执 ...
- 前端js代码优化
今天给大家分享下js代码优化的相关技巧. 1.使用"+"转换为数值 我们平时开发过程中需要将数字字符串创转为number类型,大多数都会用JavaScript parseI ...
- MacbookPro管理员问题
更改用户名重启之后,发现用户名还是用户名,管理员权限降成了普通用户. 参考这个帖子改的用户名: https://zhidao.baidu.com/question/259845860.html 找回管 ...
- U盘制作centos7系统并安装
U盘刻录步骤 1.下载centos镜像(https://mirrors.aliyun.com/centos/7.4.1708/isos/x86_64/) 2.使用UltraISO刻录U盘启动系统 安装 ...
- golang urlencode
u := url.Values{} u.Set(") u.Set(") u.Set(,"mac":"38:a4:ed:fe:99:c8"}` ...
- SQL SERVER FOR LINUX初体验
今天得空,就在Ubuntu17.04上安装了SQL SERVER 2017体验下,总体来说还是不错的. 在Ubuntu上安装SQL SERVER 2017还是比较方便的,只需几条命令即可: curl ...
- C/C++语言简介之运算符
比较特别的是,比特右移(>>)运算符可以是算术(左端补最高有效位)或是逻辑(左端补 0)位移.例如,将 11100011 右移 3 比特,算术右移后成为 11111100,逻辑右移则为 0 ...
- Centos6增加新用户并赋予权限
第一步:创建用户并设置密码 useradd testuser // 增加用户名为'testuser'的用户 passwd testpasswd //设定密码为'testpasswd' 第二步:用户授权 ...
- iOS实现从服务器请求json数据并转化成NSDictionary
NSURL *url = [NSURL URLWithString:URL]; NSURLRequest *request = [NSURLRequest requestWithURL:url cac ...