JPress保存文章报错的解决办法

JPress之家发布 JPress建站 2016-09-05 124

一保存文章就报错如下错误:

 

2016-06-13 09:59:32
[ERROR]-[Thread: http-nio-8080-exec-13]-[freemarker.log._Log4jLoggerFactory$Log4jLogger.error()]: Error executing FreeMarker template
FreeMarker template error:
Can't convert the date-like value to string because it isn't known if it's a date (no time part), time or date-time value.
The blamed expression:
==> content.created!  [in template "templates/JBlog/content.html" at line 33, column 43]
 
----
Tip: Use ?date, ?time, or ?datetime to tell FreeMarker the exact type.
----
Tip: If you need a particular format only once, use ?string(pattern), like ?string('dd.MM.yyyy HH:mm:ss'), to specify which fields to display. 
----
 
----
FTL stack trace ("~" means nesting-related):
    - Failed at: ${content.created!}  [in template "templates/JBlog/content.html" at line 33, column 41]
    ~ Reached through: #nested  [in template "templates/JBlog/_layout.html" in macro "layout" at line 72, column 1]
    ~ Reached through: @layout  [in template "templates/JBlog/content.html" at line 17, column 1]
----
 
Java stack trace (for programmers):
----
freemarker.core._TemplateModelException: [... Exception message was already printed; see it above ...]
    at freemarker.core.MessageUtil.newCantFormatUnknownTypeDateException(MessageUtil.java:290)
    at freemarker.core.Environment.getTemplateDateFormat(Environment.java:1230)
    at freemarker.core.Environment.formatDate(Environment.java:1181)
    at freemarker.core.EvalUtil.coerceModelToString(EvalUtil.java:347)
    at freemarker.core.Expression.evalAndCoerceToString(Expression.java:82)
    at freemarker.core.DollarVariable.accept(DollarVariable.java:41)
    at freemarker.core.Environment.visit(Environment.java:324)
    at freemarker.core.MixedContent.accept(MixedContent.java:54)
    at freemarker.core.Environment.visit(Environment.java:324)
    at freemarker.core.Environment.invokeNestedContent(Environment.java:546)
    at freemarker.core.BodyInstruction.accept(BodyInstruction.java:56)
    at freemarker.core.Environment.visit(Environment.java:324)
    at freemarker.core.MixedContent.accept(MixedContent.java:54)
    at freemarker.core.Environment.visit(Environment.java:324)
    at freemarker.core.Macro$Context.runMacro(Macro.java:184)
    at freemarker.core.Environment.invoke(Environment.java:701)
    at freemarker.core.UnifiedCall.accept(UnifiedCall.java:84)
    at freemarker.core.Environment.visit(Environment.java:324)
    at freemarker.core.MixedContent.accept(MixedContent.java:54)
    at freemarker.core.Environment.visit(Environment.java:324)
    at freemarker.core.Environment.process(Environment.java:302)
    at freemarker.template.Template.process(Template.java:325)
    at io.jpress.core.render.JFreemarkerRender.render(JFreemarkerRender.java:63)
    at com.jfinal.core.ActionHandler.handle(ActionHandler.java:97)
    at com.jfinal.plugin.druid.DruidStatViewHandler.handle(DruidStatViewHandler.java:75)
    at io.jpress.core.cache.ActionCacheHandler.handle(ActionCacheHandler.java:87)
    at io.jpress.core.JHandler.handle(JHandler.java:78)
    at io.jpress.core.cache.ActionCacheHandler.handle(ActionCacheHandler.java:42)
    at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
 
2016-06-13 09:59:32
[ERROR]-[Thread: http-nio-8080-exec-13]-[com.jfinal.core.ActionHandler.handle()]: /c/%E9%89%B4%E6%9D%83%E6%8E%A5%E5%8F%A3%E6%96%87%E6%A1%A3
com.jfinal.render.RenderException: freemarker.core._TemplateModelException: Can't convert the date-like value to string because it isn't known if it's a date (no time part), time or date-time value.
The blamed expression:
==> content.created!  [in template "templates/JBlog/content.html" at line 33, column 43]
 
----
Tip: Use ?date, ?time, or ?datetime to tell FreeMarker the exact type.
----
Tip: If you need a particular format only once, use ?string(pattern), like ?string('dd.MM.yyyy HH:mm:ss'), to specify which fields to display. 
----
 
----
FTL stack trace ("~" means nesting-related):
    - Failed at: ${content.created!}  [in template "templates/JBlog/content.html" at line 33, column 41]
    ~ Reached through: #nested  [in template "templates/JBlog/_layout.html" in macro "layout" at line 72, column 1]
    ~ Reached through: @layout  [in template "templates/JBlog/content.html" at line 17, column 1]
----
    at io.jpress.core.render.JFreemarkerRender.render(JFreemarkerRender.java:72)
    at com.jfinal.core.ActionHandler.handle(ActionHandler.java:97)
    at com.jfinal.plugin.druid.DruidStatViewHandler.handle(DruidStatViewHandler.java:75)
    at io.jpress.core.cache.ActionCacheHandler.handle(ActionCacheHandler.java:87)
    at io.jpress.core.JHandler.handle(JHandler.java:78)
    at io.jpress.core.cache.ActionCacheHandler.handle(ActionCacheHandler.java:42)
    at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: freemarker.core._TemplateModelException: Can't convert the date-like value to string because it isn't known if it's a date (no time part), time or date-time value.
The blamed expression:
==> content.created!  [in template "templates/JBlog/content.html" at line 33, column 43]
 
----
Tip: Use ?date, ?time, or ?datetime to tell FreeMarker the exact type.
----
Tip: If you need a particular format only once, use ?string(pattern), like ?string('dd.MM.yyyy HH:mm:ss'), to specify which fields to display. 
----
 
----
FTL stack trace ("~" means nesting-related):
    - Failed at: ${content.created!}  [in template "templates/JBlog/content.html" at line 33, column 41]
    ~ Reached through: #nested  [in template "templates/JBlog/_layout.html" in macro "layout" at line 72, column 1]
    ~ Reached through: @layout  [in template "templates/JBlog/content.html" at line 17, column 1]
----
    at freemarker.core.MessageUtil.newCantFormatUnknownTypeDateException(MessageUtil.java:290)
    at freemarker.core.Environment.getTemplateDateFormat(Environment.java:1230)
    at freemarker.core.Environment.formatDate(Environment.java:1181)
    at freemarker.core.EvalUtil.coerceModelToString(EvalUtil.java:347)
    at freemarker.core.Expression.evalAndCoerceToString(Expression.java:82)
    at freemarker.core.DollarVariable.accept(DollarVariable.java:41)
    at freemarker.core.Environment.visit(Environment.java:324)
    at freemarker.core.MixedContent.accept(MixedContent.java:54)
    at freemarker.core.Environment.visit(Environment.java:324)
    at freemarker.core.Environment.invokeNestedContent(Environment.java:546)
    at freemarker.core.BodyInstruction.accept(BodyInstruction.java:56)
    at freemarker.core.Environment.visit(Environment.java:324)
    at freemarker.core.MixedContent.accept(MixedContent.java:54)
    at freemarker.core.Environment.visit(Environment.java:324)
    at freemarker.core.Macro$Context.runMacro(Macro.java:184)
    at freemarker.core.Environment.invoke(Environment.java:701)
    at freemarker.core.UnifiedCall.accept(UnifiedCall.java:84)
    at freemarker.core.Environment.visit(Environment.java:324)
    at freemarker.core.MixedContent.accept(MixedContent.java:54)
    at freemarker.core.Environment.visit(Environment.java:324)
    at freemarker.core.Environment.process(Environment.java:302)
    at freemarker.template.Template.process(Template.java:325)
    at io.jpress.core.render.JFreemarkerRender.render(JFreemarkerRender.java:63)
    ... 24 more

 

 

对于这种错误,一般建议大家先确认是否已经更新最新代码,jpress发布文章模块现在已经很稳定了。