You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Geir Magnusson Jr." <ge...@yahoo.com> on 2001/11/12 09:57:12 UTC

Re: The "proper" way to configure/deploy Velocity servlets on an app server?

On 11/11/01 11:32 PM, "Blair Martin" <bl...@mindspring.com> wrote:

> I'm deploying an app on an app server (iPortal App. Server). The web app
> portion (servlets using Velocity) is packaged in a .war file which in turn
> is packaged in a .ear file along with other components (e.g. .jar file
> containg EJBs). This is then deployed on the server. My question concerns
> the "proper" way to configure Velocity vis-a-vis the templates, properties
> file and output log. I've read the docs and archives so I know how to get
> things working but I wonder if I'm doing it the best way.
> 
> Initially, I tried using the file resource loader but this doesn't seem to
> be a good idea because it's difficult to locate the templates. The app
> server deals with .ear/.war.jar files so I don't even know what the real
> path to the template files would be ( getServletContext().getRealPath()
> returns null ). So I next tried class path resource loader after packaging
> the template files in a .jar in the WEB-INF/lib directory. This worked. Is
> this the best way to do it? Is there something I'm missing with using file
> resource loader?

I do it this way myself to avoid the path issue, although I do sometimes us
the file loader as well.

> 
> The uncertainty of runtime paths also has me confused about where to put a
> properties file (and where velocity.log is written). I know you can specify
> a path as an init-parameter in web.xml but it's unclear what the path is
> relative to. In other words, at runtime the servlet doesn't seem to know
> anything about the web app root (ie. the location of WEB-INF). In my case,
> if default locations are used (no paths specified) than velocity.log, for
> example, is written to the iPortal bin directory (\iportal\ipas3\bin). I
> guess what I'm asking is how do I get the full, runtime path to the web app
> root. As I write this I realize I'm not being totally Velocity-centric with
> my question but perhaps someone who addresses the earlier question might be
> able to help.

Yes - Velocity will put the runtime log in the 'current directory' by
default.  So you can either change this by setting "runtime.log" before
init(), or do something completely different, like use a custom log class
(See the log example in /examples..)

Geir

> 
> Thanks!
> 
> Blair Martin
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr.                       geirm@optonline.net
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>