Random template not found with Freemarker

浪尽此生 提交于 2020-01-06 15:05:53

问题


I'm using FreeMarker with a Play 2.3.8 app. When I execute my tests, sometimes I get the following error :

Caused by: java.io.FileNotFoundException: Template "MyTemplate.tpl" not found. The quoted name was interpreted by this template loader: ClassTemplateLoader(baseClass=com.project.TemplateEngineConfigurer, packagePath="templates/").

MyTemplate.tpl is in com.project.templates package and I'm using the following configuration :

    Configuration config = new Configuration(Configuration.getVersion());
    config.setClassForTemplateLoading(getClass(), "templates");
    config.setDefaultEncoding("UTF-8");
    config.setCacheStorage(new MruCacheStorage(20, 250));
    return config;

I can't understand why I have randomly, file not found exception... Is it an Eclipse problem ? A cache problem ?

Thanks.

来源:https://stackoverflow.com/questions/28987504/random-template-not-found-with-freemarker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!