Java 在velocity模板中包含另一个vm文件时找不到资源

Java 在velocity模板中包含另一个vm文件时找不到资源,java,include,velocity,template-engine,Java,Include,Velocity,Template Engine,我有以下代码: public class EmailService { static { Velocity.setProperty("resource.loader", "class"); Velocity.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceL

我有以下代码:

public class EmailService {
        static {
        Velocity.setProperty("resource.loader", "class");
        Velocity.setProperty("class.resource.loader.class",
                "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
        Velocity.init();

        try {
            InputStream in = EmailService.class.getClassLoader()
                    .getResourceAsStream("support.properties");
            Properties prop = new Properties();
            prop.load(in);
            SUPPORT_EMAIL = prop.getProperty("mail", "");
        } catch (IOException e) {
            throw new RuntimeException("IOException while reading support.properties");
        }
    }

    ....


    private String getResultString(VelocityContext context, Template velocityTemplate) {
        StringWriter writer = new StringWriter();
        velocityTemplate.merge(context, writer);
        return writer.toString();
    }
}
执行第行时:

velocityTemplate.merge(context, writer);
我看到以下错误:

Method threw 'org.apache.velocity.exception.ResourceNotFoundException' exception.
....
Unable to find resource 'footer.vm'
我的模板如下所示:

trololo
#include("footer.vm")
这两个模板位于文件系统附近。
如何修复此问题?

替换路径后工作

#include("velocityTemplates/footer.vm")

也许这个答案会有所帮助:@cheb1k4我已经读过了——没有;帮不上忙