db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Goschl,Siegfried" <Siegfried.Goes...@drei.com>
Subject RE: Web Applications
Date Wed, 28 Jan 2004 09:22:15 GMT
Finding the Torque.properties file also depends on your application server. In the case of
BEA WebLogic I had the same problem with unexploded WAR files. Therefore I used the class
loading incarnation of commons configuration - I can send you my source code to your private
mail account

If you have more thing to initialize and manage in as servlet (and have a little bit of spare
time) you should look at a service framework such as Turbine or Avalaon.


Siegfried Goeschl

-----Original Message-----
From: Hassan Abolhassani [mailto:Hassan.Abolhassani@razorfish.co.jp]
Sent: Tuesday, January 27, 2004 7:33 AM
To: Apache Torque Users List
Subject: Re: Web Applications

>Hey everybody, st00pid newbie here... I've gone through the torque 
>tutorial successfully and experimented a bit beyond it but now I'm 
>trying to use torque in a web application for the first time and have 
>run into some trouble.  I'm confused about the Torque.properties file 
>and the init() method.  I've placed the Torque.properties file in the 
>root of my .war, in WEB-INF/, WEB-INF/classes, WEB-INF/lib, just about 
>everywhere, but when I call init("Torque.properties") it can't find it. 
>  Where is it supposed to live and how do I reference it?  

My solution is to have an initializer servlet. It passes a phycial path
of the properties file to the init(). Attached is a copy of that servlet
that might be usefull for you. 

You need to make it called when the servlet engine is started. To do
that the following snippet in web.xml of your application will work:





Please note that the servlet also initializes log4j, which you may want
to ignore it.

>Also, do I 
>call init() in each class that uses Torque or do I need to somehow only 
>call it once when the web app is deployed?  Sorry if this is a dumb 
>question, but I can't find anything in the docs to help me.  Thanks 

You only need to call init() one time.

--Travis Hanna


Razorfish Japan, Inc.

アボルハッサニ ハッサン   Hassan Abolhassani  [Technology network]
株式会社 レーザーフィッシュ・ジャパン
Tel:03-5436-9980 Fax:03-5436-9126

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

View raw message