db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andras Balogh <and...@reea.net>
Subject Re: Torque and jsp
Date Tue, 15 Mar 2005 14:48:18 GMT

    Why don't You put the torque.properties file in WEB-INF/classes/ and 
load it like this:
                PropertiesConfiguration pc = new PropertiesConfiguration();
this.getClass().getClassLoader().getResourceAsStream("torque.properties") );
    This way You don't have to hardcode any path and it will work on any 
I use this  in a Servlet but I don't see why it wouldn't work in a jsp too.

Best regards,

raphael.x.mankin@gsk.com wrote:

>Torque.init() requires an absolute pathname. It's a bummer.
>I put the true pathname in another properties file so that I do not have to
>hard-code it in the program. This does mean, however, that I have to know
>the absolute path where, in my case, Tomcat is installed. Here is my
>initialisation code
>        apiResources = ResourceBundle.getBundle("betapi");
>        if (!Torque.isInit()) {
>            String configFile = apiResources.getString
>            try {
>                Torque.init(configFile);
>            } catch (TorqueException e) {
>                  context.log(e,"Cannot initalise Torque: " + e.toString()
>                e.printStackTrace(System.err);
>                System.exit(1);
>            }
>        }
>and betapi.properties contains:
>      betapi.torqueconfig=
>In cases where I build on one machine but run on another I have a little
>shell script that that runs on installation. It tracks down the appropriate
>line in betapi.properties and adjusts it so suit where the code is actually

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

View raw message