You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Dennis Cartier <de...@canadianblackbook.com> on 2004/05/26 18:54:51 UTC

Did something change with class loading behaviour between 1.3.X and 1.4?

When attempting to use Velocity 1.4 with our JBoss 3.0.7 servlet containers
I am getting different results than with 1.3.X.

I use the class resource loader to access the templates stored in a JAR file
in the /lib directory inside each applications WAR file. Under 1.3.X this
works great. Under 1.4, Velocity is not able to find any templates. This
version of JBoss defaults to using the Servlet 1.2 method of class loading
and uses the class contained in the application's WAR file before delegating
to JBoss's class loader.

I override the loadConfiguration method in the VelocityServlet (which I use
by the way), to point Velocity at a properties file contained in the
/WEB-INF directory of the WAR file. I have tried it with and without
overriding loadConfiguration just incase this was no longer required, but no
luck.

Anyone have any idea what changed and how to achieve the previous behaviour
using 1.4?

Thanks,

Dennis


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


RE: Did something change with class loading behaviour between 1.3.X and 1.4?

Posted by Dennis Cartier <de...@canadianblackbook.com>.
> Dennis Cartier said:
> > When attempting to use Velocity 1.4 with our JBoss 3.0.7
> servlet containers
> > I am getting different results than with 1.3.X.
> >
> > I use the class resource loader to access the templates stored
> in a JAR file
> > in the /lib directory inside each applications WAR file. Under
> 1.3.X this
> > works great. Under 1.4, Velocity is not able to find any templates. This
> > version of JBoss defaults to using the Servlet 1.2 method of
> class loading
> > and uses the class contained in the application's WAR file
> before delegating
> > to JBoss's class loader.
>
> well, if your properties aren't getting loaded (below), then
> Velocity probably
> doesn't know to use the class resource loader anymore.

That was it. The properties were not being loaded.

>
> > I override the loadConfiguration method in the VelocityServlet
> (which I use
> > by the way), to point Velocity at a properties file contained in the
> > /WEB-INF directory of the WAR file. I have tried it with and without
> > overriding loadConfiguration just incase this was no longer
> required, but no
> > luck.
> >
> > Anyone have any idea what changed and how to achieve the
> > previous behaviour using 1.4?
> ...
>
> i can't tell you what you're problem is without seeing the
> pertinent section
> of your web.xml and the code you use when overriding
> loadConfiguration, but i
> can point you to the difference between 1.3.X and 1.4....
>
> http://cvs.apache.org/viewcvs.cgi/jakarta-velocity/src/java/org/ap
> ache/velocity/servlet/VelocityServlet.java?r1=1.52.4.1&r2=1.44&dif
> f_format=h

My loadConfiguration was using the constant INIT_PROPS_KEY, but my XDoclet
tag was inserting the deprecated name "properties" into web.xml.

>
> Also, please note that the VelocityServlet is deprecated in
> Velocity 1.5-dev.
> It is now recommended that you use the VelocityViewServlet in the
> VelocityTools project.  henceforth, Velocity will concentrate on it's core
> competencies and leave web related stuff to the VelocityTools project.

I will start looking for info on migrating to the newer package.

Thanks,

Dennis

>
> Nathan Bubna
> nathan@esha.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>


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


Re: Did something change with class loading behaviour between 1.3.X and 1.4?

Posted by Nathan Bubna <na...@esha.com>.
Dennis Cartier said:
> When attempting to use Velocity 1.4 with our JBoss 3.0.7 servlet containers
> I am getting different results than with 1.3.X.
>
> I use the class resource loader to access the templates stored in a JAR file
> in the /lib directory inside each applications WAR file. Under 1.3.X this
> works great. Under 1.4, Velocity is not able to find any templates. This
> version of JBoss defaults to using the Servlet 1.2 method of class loading
> and uses the class contained in the application's WAR file before delegating
> to JBoss's class loader.

well, if your properties aren't getting loaded (below), then Velocity probably
doesn't know to use the class resource loader anymore.

> I override the loadConfiguration method in the VelocityServlet (which I use
> by the way), to point Velocity at a properties file contained in the
> /WEB-INF directory of the WAR file. I have tried it with and without
> overriding loadConfiguration just incase this was no longer required, but no
> luck.
>
> Anyone have any idea what changed and how to achieve the
> previous behaviour using 1.4?
...

i can't tell you what you're problem is without seeing the pertinent section
of your web.xml and the code you use when overriding loadConfiguration, but i
can point you to the difference between 1.3.X and 1.4....

http://cvs.apache.org/viewcvs.cgi/jakarta-velocity/src/java/org/apache/velocity/servlet/VelocityServlet.java?r1=1.52.4.1&r2=1.44&diff_format=h

Also, please note that the VelocityServlet is deprecated in Velocity 1.5-dev.
It is now recommended that you use the VelocityViewServlet in the
VelocityTools project.  henceforth, Velocity will concentrate on it's core
competencies and leave web related stuff to the VelocityTools project.

Nathan Bubna
nathan@esha.com


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