velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Glass-Husain" <wglasshus...@gmail.com>
Subject Re: How to use Velocity inside JBOSS
Date Tue, 11 Mar 2008 23:21:52 GMT
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 <
cristi-cioriia@criticalsoftware.com> 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: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>


-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message