异常-----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 严 ...
随机推荐
- 除了使用URLSearchParams处理axios发送的数据,但是兼容性不好,其他的兼容方法
在使用axios这个ajax插件的时候,我们有些时候会遇到一些问题,比如:数据格式不正确 以最简单的例子为基础(这里使用post方法): 在上面的例子中我们直接调用axios的post方法,传给后台的 ...
- vue2.0父子组件之间通信
父组件是通过props属性给子组件通信的来看下代码: 父组件: <parent> <child :child-com="content"></chil ...
- SqlServer循环 和 批量倒数据
SqlServer循环语句 declare @i int set @i =1 while(@i<5) begin set @i = @i+1 insert into text(id,name ...
- .net使用AsposeWord导出word table表格
本文为原创,转载请注明出处 1.前言 .net平台下导出word文件还可以使用Microsoft.Office.Interop和NPOI,但是这两者都有缺点,微软的Office.Interop组件需要 ...
- python语言基础汇总
注释 代码中添加注释是一个良好的编程习惯,python语言的注释才用井号'#'作为注释开头的,可以是任意内容,解释器会忽略掉这部分内容.其他每一行都是语句,当语句以冒号':'结尾时,缩进的语句视为代码 ...
- 共享数据的包含const
1.常引用:被引用的对象不能被更新 使用:const 类型名 &引用对象 如const int &a; 2.常对象:必须进行初始化,并且对象不能改变 使用:类名 const ...
- PHP中cookies跨目录无法调用解决办法
localhost/a/test.php 中写入: <?php setcookie("user","zhangsan",time()+3600); ?&g ...
- 利用Jsonp实现跨域请求,spring MVC+JQuery
1 什么是Jsonp? JSONP(JSON with Padding)是数据格式JSON的一种"使用模式",可以让网页从别的网域要数据.另一个解决这个问题的新方法是跨来源资源共享 ...
- 10分钟入门kubernetes(上)
kubernetes简称k8s, 主要用途是automate deployment, scaling, and managment of containerized applications.是目前非 ...
- tomcat使用cookies缓存的时候中文报错解决办法 java.lang.IllegalArgumentException: Control character in cookie value or attribute.
报错出现 java.lang.IllegalArgumentException: Control character in cookie value or attribute. at org.apac ...