velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinobu Kawai <shinobu.ka...@gmail.com>
Subject Re: How to config velocity to use ClasspathResourceLoader?
Date Tue, 02 Nov 2004 07:51:57 GMT

Hi Carfield,

> Can anybody tell me how to setup VelocityEngine to use
> ClasspathResourceLoader?
    http://jakarta.apache.org/velocity/api/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.html

> I've the following code but fail to work:
> 
> VelocityEngine ve = new VelocityEngine();
> ve.setProperty("resource.loader", "class");
> ve.setProperty("class.resource.loader.class","org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
> Template t = ve.getTemplate(templatePath, "UTF-8");
> t.merge(velocityContext, writer);
> 
> At "Template t = ve.getTemplate(templatePath, "UTF-8");", I get
> NullPointerException, can anyone give me some hint about that?
What does the stack trace have to say?
What was inside "templatePath"?
What was inside "velocityContext"?
Where is the classpath?
Where is the template?  What does it look like?

Asking yourself these questions should lead you to the solution. 
(Hopefully ;))

Best regards,
-- Shinobu Kawai

--
Shinobu Kawai <shinobu.kawai@gmail.com>


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message