Apache Velocity can not Initialize
java, velocity
Solution
try something like this:
Properties p = new Properties();
p.setProperty("resource.loader", "class");
p.setProperty("class.resource.loader.description", "Velocity Classpath Resource Loader");
p.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
try {
Velocity.init(p);
} catch(...., and handle excpetion
}
you'll now be able to call:
VelocityContext vContext = new VelocityContext(context);
//put things into vContext
StringWriter sw = new StringWriter();
try {
template.merge(vContext, sw);
etc.
Problem
When i try to initialize velocity engine using ``` VelocityEngine engine = new VelocityEngine(); engine.init(); ``` I encounter the same error when i try ``` Velocity.init(); ``` org.apache.velocity.exception.VelocityException: Failed to initialize an instance of org.apache.velocity.runtime.log.ServletLogChute with the current runtime configuration. What may cause this exception?