velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "White, Tim" <>
Subject RE: How to use Velocity inside JBOSS
Date Wed, 12 Mar 2008 01:06:57 GMT
Hi Will -
 I'm curious, does this thread context classloading apply to resource loaders and tools as
well as templates?
 We've had trouble in the past if velo loaded in the app ear, but the resource loaders was
in the webapp.


From: Will Glass-Husain []
Sent: Tue 3/11/2008 5:21 PM
To: Velocity Users List
Subject: Re: How to use Velocity inside JBOSS

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.


On Tue, Mar 11, 2008 at 8:21 AM, Cristi Cioriia <> 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:
> For additional commands, e-mail:

Forio Business Simulations

Will Glass-Husain

This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message