velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr. <>
Subject Re: Location of velocity-1.3.jar in war file
Date Fri, 20 Dec 2002 03:33:04 GMT

On Thursday, December 19, 2002, at 05:47 PM, David You wrote:

> Hi, question about where I should put velocity-1.3.jar in the web 
> server.
> I am using IPlanet 6.
> It seems that I have to put the velocity-1.3.jar into the lib 
> directory of
> the WAR file in order for it to find the VM resources ( I am using
> org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader to 
> read
> the template).
> That works fine for me.(Just a little bigger size for my WAR file).
> It is a bug, a feature or what? Anyway, I think It should be in the 
> document
> so people don't have to spend time to figure it out.

You are wading into is generally muddy and treacherous waters.  I have 
no idea how IPlanet classloaders work in webapps, but this is a 
complicated area, generally, and requires an understanding of how 
servlet containers deal with classloaders.

in brief :

What is supposed to happen is that the classloader in a web app is 
isolated from the classloaders in other webapps - this gives each 
webapp it's own environment to safely create singletons and such, as 
they are created by the classloader.  That way the apps don't interact.

The ClasspathResourceLoader uses the classloader to find resources.  if 
you put Velocity.jar in the lib directory, then it will be created by a 
classloader that is an ancestor of the webapp classloader (i.e it's a 
parent, or grandparent or... depends on how IPlanet works...), so it 
won't see the classpath of the webapp.   When you put it in your 
webapp, the webapp classloader creates your velocity instances, and 
thus that classpath is used to load resources.

So, for safety and ease of deployment (you want all the resources/code 
for a webapp to be deployed with the webapp...), keeping it in the WAR 
is the right thing to do....

Geir Magnusson Jr                                   203-355-2219(w)
Adeptra, Inc.                                       203-247-1713(m)

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

View raw message