I have following code:
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();
}
}
when executes line:
velocityTemplate.merge(context, writer);
I see the following error:
Method threw 'org.apache.velocity.exception.ResourceNotFoundException' exception.
....
Unable to find resource 'footer.vm'
my template looks like this:
trololo
#include("footer.vm")
these two templates resides near on the filesystem.
How to fix this?