java - Apache Velocity can not Initialize -
When I initialize the velocity engine using the VelocityEngine engine = New VelocityEngine () I try to; Engine.init ();
When I try, I get the same error
Velocity.init ();
org.apache.velocity.exception.VelocityException: failed to initialize an instance of org.apache.velocity.runtime.log.ServletLogChute with current runtime configuration.
What could be the reason for this exception?
Try to do 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);
You will now be able to call:
velocitycontact vContext = New VelocityContext (reference) ; // vContext StringWriter puts things in sw = new stringwriter (), try {template.merge (vContext, sw);
etc.
Comments
Post a Comment