Hi Cristi,

What version of Velocity are you using?

Prior to 1.5, Velocity could have problems finding resources loaded in a
different classloader.  Now it looks in the Thread context classloader so
you can have the Velocity jar (for example) at the app server level and the
templates at the webapp level.

WILL

On Tue, Mar 11, 2008 at 8:21 AM, Cristi Cioriia <
[EMAIL PROTECTED]> wrote:

> Thank you for your reply. Unfortunately, it is not clear for me yet how
> to use the classpath loader or the webapp loader. I have tried doing
> something like:
>
> VelocityEngine velocityEngine = new VelocityEngine();
>       Properties prop = new Properties();
>       prop.setProperty("resource.loader", "class");
>       prop.setProperty("class.resource.loader.class",
> "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
>       velocityEngine.init(prop);
>
> but the template still cannot be located. My application is a J2EE
> application, so its structure is something like:
> src/main/java/pojos/TemplateUtils(contains the code above),
> src/main/java/mypackage/statelessBean(uses TemplateUtils)
> and src/resources/META-INF/mytemplate.vm. The application jar package
> and the velocity jar package are placed inside an ear package that is
> deployed in jboss. I have tried all the ways that I could think of for
> setting the path to mytemplate.vm and still couldn't make it work. So it
> is not clear for me where Velocity starts looking for template; the
> documentation says in the current working directory, but what is this?
> Is it important that my application is packaged in a jar file(java
> classes and the templates) and it references the velocity engine that is
> located in another jar package?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Forio Business Simulations

Will Glass-Husain
[EMAIL PROTECTED]
www.forio.com

Reply via email to