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