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: [EMAIL PROTECTED]

Web: http://www.lmu.de/internet/



[EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-- 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




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to