Return-Path: Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 76181 invoked from network); 17 Apr 2003 21:01:59 -0000 Received: from unknown (HELO secfw2.sec.gov) (204.192.28.12) by daedalus.apache.org with SMTP; 17 Apr 2003 21:01:59 -0000 Received: by secfw2.sec.gov; id h3HL1T407277; Thu, 17 Apr 2003 17:01:29 -0400 Received: from exchange.sec.gov(162.138.65.52) by secfw2.sec.gov via smap id xma007263; Thu, 17 Apr 03 17:01:22 -0400 Received: by opc-sec-mt1.sec.gov with Internet Mail Service (5.5.2653.19) id <2TMLCH6S>; Thu, 17 Apr 2003 17:01:21 -0400 Message-ID: From: "Keeney, Thomas" To: "'Turbine Torque Users List'" Subject: RE: Torque.init() can't find project.properties from servlet Date: Thu, 17 Apr 2003 17:01:16 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Geoff, If your properties file is located in a jar, you must specify the path relative to the jar file. For example, let's assume you have a jar in your classpath containing the properties file: com/yourproject/om/Torque.properties. Then, use the following code to load that file: InputStream is = TorqueInit.class.getClassLoader().getResourceAsStream("com/yourproject/om/To rque.properties"); Configuration config = new PropertiesConfiguration(); config.load(is); Torque.init(config); Regards, Tom -----Original Message----- From: Geoff Fortytwo [mailto:g42@ign.com] Sent: Thursday, April 17, 2003 3:02 PM To: Turbine Torque Users List; 'Turbine Torque Users List' Subject: RE: Torque.init() can't find project.properties from servlet That's a great solution so long as the properties file isn't in a jar file. If it's in a jar file then you'll need to use the solution I mentioned in my previous post. At 06:46 AM 4/17/2003, Keeney, Thomas wrote: >Gabe, > >Try passing in the full path to your properties file: > > URL propsFile = >TorqueInit.class.getClassLoader().getResource("project.properties"); > Torque.init(propsFile.getPath()); > > >Regards, > >Tom > >-----Original Message----- >From: Gabriel Bauman [mailto:gabe@bravenet.com] >Sent: Wednesday, April 16, 2003 5:20 PM >To: torque-user@db.apache.org >Subject: Torque.init() can't find project.properties from servlet > > >Hello again, > >I am using Torque in a servlet environment. I can't seem to get Torque >to see my project.properties file, which contains the db settings etc, >even though it's in my WEB-INF/classes folder and is on the classpath. > >java.io.FileNotFoundException: project.properties (The system cannot >find the file specified) >... > at org.apache.torque.Torque.init(Torque.java:386) > >I'm kind of at a loss, can anyone offer some insight? I am using a >recent CVS snapshot of Torque. > >Thanks, > >Gabe > > >--------------------------------------------------------------------- >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 --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org