NutzCN Logo
问答 Freemarker TemplateNotFound
发布于 3263天前 作者 Kerbores 3773 次浏览 复制 上一个帖子 下一个帖子
标签:

错误信息

2016-1-22 11:0:23.339 WARN [http-nio-8080-exec-5] Error@/hello :
java.lang.RuntimeException: freemarker.template.TemplateNotFoundException: Template not found for name "template/test.ftl".
The name was interpreted by this TemplateLoader: WebappTemplateLoader(subdirPath="/Users/ixion/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/freemarker-view/WEB-INF/", servletContext={contextPath="/freemarker", displayName="free"}).
	at org.nutz.lang.Lang.wrapThrow(Lang.java:148)
	at com.kerbores.nutz.freemarker.FreemarkerView.render(FreemarkerView.java:80)
	at org.nutz.mvc.impl.processor.ViewProcessor.process(ViewProcessor.java:55)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:28)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:40)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:119)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:179)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	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:521)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: freemarker.template.TemplateNotFoundException: Template not found for name "template/test.ftl".
The name was interpreted by this TemplateLoader: WebappTemplateLoader(subdirPath="/Users/ixion/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/freemarker-view/WEB-INF/", servletContext={contextPath="/freemarker", displayName="free"}).
	at freemarker.template.Configuration.getTemplate(Configuration.java:1833)
	at freemarker.template.Configuration.getTemplate(Configuration.java:1646)
	at com.kerbores.nutz.freemarker.FreemarkerView.render(FreemarkerView.java:76)
	... 35 more

代码:

@At
	@Ok("ftl:template.test")
	public Result hello() {
		return Result.success().addData("ip", _ip());
	}

https://team.oschina.net/action/teamShare/view?id=25852&fn=0404b057eb400b057fad5f41720edc8f8e0c4340&team=38164&undefined

7 回复

顺便nutz.cn 传图貌似有问题,走神儿了,@ wendel 兽总看下

放的地方不对, 默认是 /WEB-INF/ + $path

图片上传已fix @kerbores

@wendal 看起来我的目录结构和路径貌似是没有问题的,是不是属于那种自己写的看不出来的

在这个路径找一下 /Users/ixion/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/freemarker-view/WEB-INF/

查看是文件是安静的躺在那里的,但是就是提示找不到,已经用 beetl 在弄了,晚上回去再看 freemarker 重新搞一下看

添加回复
请先登陆
回到顶部