如何打开文件.ftl到war文件中

时间:2017-01-30 17:27:21

标签: java spring templates jboss war

我尝试从我的war文件中打开一个ftl文件

// Load Template
Template template = cfg.getTemplate("template.ftl");

模板模板位于路径java / main / resources / template.ftl

但是当我尝试从类访问template.ftl文件时,向我发送以下错误:

18:47:55,255 ERROR [stderr] (pool-4-thread-1) java.io.FileNotFoundException: Template src/main/resources/template.ftl not found.
18:47:55,263 ERROR [stderr] (pool-4-thread-1)   at freemarker.template.Configuration.getTemplate(Configuration.java:489)
18:47:55,270 ERROR [stderr] (pool-4-thread-1)   at freemarker.template.Configuration.getTemplate(Configuration.java:452)
18:47:55,289 ERROR [stderr] (pool-4-thread-1)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
18:47:55,292 ERROR [stderr] (pool-4-thread-1)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
18:47:55,295 ERROR [stderr] (pool-4-thread-1)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
18:47:55,303 ERROR [stderr] (pool-4-thread-1)   at java.lang.reflect.Method.invoke(Method.java:606)
18:47:55,306 ERROR [stderr] (pool-4-thread-1)   at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)
18:47:55,309 ERROR [stderr] (pool-4-thread-1)   at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(
18:47:55,312 ERROR [stderr] (pool-4-thread-1)   at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
18:47:55,315 ERROR [stderr] (pool-4-thread-1)   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
18:47:55,319 ERROR [stderr] (pool-4-thread-1)   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
18:47:55,322 ERROR [stderr] (pool-4-thread-1)   at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(
18:47:55,326 ERROR [stderr] (pool-4-thread-1)   at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(
18:47:55,329 ERROR [stderr] (pool-4-thread-1)   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
18:47:55,332 ERROR [stderr] (pool-4-thread-1)   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
18:47:55,336 ERROR [stderr] (pool-4-thread-1)   at java.lang.Thread.run(Thread.java:745)

当我打印绝对路径时,请使用jboss服务器。

任何人都知道如何从战争中打开这种类型的文件。

感谢您的帮助。

0 个答案:

没有答案