Rock on! I will give that a try. Thanx Gary
-----Original Message----- From: Gary Hardy [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 1:52 PM To: Tomcat Users List Subject: Re: reading properties file.... Russ: In general, if application.properties is in your classes dir ResourceBundle rez = ResourceBundle.getBundle("application"); Put that in your singleton class. Then you could: MySingleton.accessMySingleton().getRez().getString("a_prop"); Then go nuts and write a taglib to access MySingleton properties. gary... > From: "Pitre, Russell" <[EMAIL PROTECTED]> > Reply-To: "Tomcat Users List" <[EMAIL PROTECTED]> > Date: Wed, 19 Nov 2003 13:13:19 -0500 > To: <[EMAIL PROTECTED]> > Subject: reading properties file.... > > Hi all, > > Trying to read a properties file for my web app....I have a singleton class > that reads my properties file and sets my properties the first time the class > is called......It reads the file fine, but after the singleton gets loaded and > i go to a jsp page that hasnt' been compiled yet i recieve this error....(at > the bottom).....here's how i'm reading the propeties file...........the error > is really wierd...when tomcat spits out the error, usually there's a carriage > return after each exception that is thrown.....but thats not the > case.......wierdness.......does anyone have any insight to my situation, I'm > especially interested in how to read a properties file correctly....my > properties file is located in the "classes" directory (is this a good idea?) > and my webapp gets deployed as a .war file....... > > InitProps.java > =================================================================== > System.out.println("#################### Server Initilization > ######################"); > > Properties props = new Properties(); > InputStream in = > getClass().getClassLoader().getResourceAsStream("application.properties" ); > > props.load(in); > System.setProperties(props); > in.close(); > System.out.println("############################# Done > ##############################"); > ===================================================================== > > > > Error: > ===================================================================== > java.lang.NullPointerExceptionnull at > java.io.Writer.write(Writer.java:126)null at java.io.PrintWriter > .newLine(PrintWriter.java:254)null at > java.io.PrintWriter.println(PrintWriter.java:405)null at java.io > .PrintWriter.println(PrintWriter.java:516)null at > org.apache.catalina.logger.LoggerBase.log(LoggerBase.java:2 > 90)null at > org.apache.coyote.tomcat4.CoyoteAdapter.log(CoyoteAdapter.java:655)null > at org.apache.coyote.t > omcat4.CoyoteAdapter.service(CoyoteAdapter.java:230)null at > org.apache.coyote.http11.Http11Processor.pr > ocess(Http11Processor.java:601)null at > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.pro > cessConnection(Http11Protocol.java:392)null at > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEnd > point.java:565)null at > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool .java: > 619)n > ull at java.lang.Thread.run(Thread.java:534)nullNov 19, 2003 1:03:38 PM > org.apache.coyote.http11.Http11Pro > cessor process > ======================================================================= > > > > Thanx > Russ > > --------------------------------------------------------------------- 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]
