db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darrell B <wi...@rogers.com>
Subject Re: Antw: torque and struts
Date Thu, 29 May 2003 22:11:58 GMT
I figured out the problem.
1. I used an absolute path to the torque properties file. (I'll load the 
file differently later)
2. Located the mysql jar to put in the lib directory of struts.
3. Modified the struts-config.xml file of struts to include driver, 
database url, user, password  as a datasource
Although, I am still initializing torque the same way by calling it from 
an action object.

Everything is working fine. Now time for improvements.

Darrell B wrote:

> Are there any tutorials or explanations available on the apache 
> jakarta site or any other places?
> I am using a singleton pattern to initialize torque from within an 
> action object which is called by a jsp.  I don't think the problem is 
> the way I
> am calling it though, but I could be wrong.
>
> /**
> * Initialize database.
> * Set the database pooling properties so data objects and torque peer 
> classes
> * can communicate with MySQL database.
> */
> public final class InitTorque {
>
>  private static InitTorque instance = new InitTorque();
>
>  private InitTorque() {
>    try {
>      Torque.init("d:\\jbproject\\metokotecan\\Torque.properties");
>    }
>    catch(Exception e) {
>      System.err.println("Error in Torque initialization " + e);
>    }
>  }
>
>  public static InitTorque getInstance() {
>
>    return instance;
>  }
>
>
>
> Alvin Antony wrote:
>
>> Hi,
>> I don't know How you are calling this method, but as the best practise
>> is to use a servlet which registered in the web.xml.
>> As far as I can remember you have to extend  your servlet class from
>> ActionServlet class.
>>
>> you can also pass the path to torque properties  as an initParameter.
>> HTH,
>> Alvin
>> Alvin K. Antony
>> Ludwig-Maximilians-Universität München
>> Internet und Virtuelle Hochschule
>> Softwareentwicklung
>> Oettingenstraße 67
>> 80538 München
>> Germany
>> -------------------------------------------
>> Phone: +49 (0)89 2102-5979
>> Fax: +49 (0)89 2102-5980
>> Mobile: +49 (0)175 9401175
>> E-Mail: aantony@lmu.de
>>
>> Web: http://www.lmu.de/internet/
>>
>>  
>>
>>>>> wimsy@rogers.com 29.05.03 22.59 Uhr >>>
>>>>>       
>>>>
>> What needs to be done to use torque with struts 1.1. 
>> private InitTorque() {
>>    try {
>>      Torque.init("Torque.properties");
>>    }
>>    catch(Exception e) {
>>      System.err.println("Error in Torque initialization " + e);
>>    }
>>  }
>>
>> I am using JBuilder in working with a struts web application using
>> torque.
>> When trying to initialize torque calling this method, I get an error 
>> that it is not able to open the torque.properties file.  Also, when I 
>> try to trace through the bug, I notice it throwing an exception, 
>> indicating that it can not locate WebappClassLoader.java from project 
>> source/class path.  I  assume I need to add some configuration 
>> settings to the struts-config.xml?
>> thanks for any help,
>> Darrell
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: torque-user-help@db.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: torque-user-help@db.apache.org
>>
>>
>>  
>>
>

-- 
Darrell Bechtel,  B.G.S., MCSE

Systems Manager
Metokote Corporation of Canada
1011 HomerWatson Blvd.
Kitchener, Ontario
Ph: (519)669-0559
Fax:(519)669-3635
http://www.metokote.com




Mime
View raw message