tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick.Hollo...@pyrites.org.uk (Nick Holloway)
Subject Re: NullPointerException at java.io.Reader when WAR file expanded.
Date Thu, 08 Feb 2001 09:14:33 GMT
In list.tomcat-user you write:
> We have a web application distributed in a WAR file that consists of
> servlets that were compiled from JSPs, one index.jsp file and a number of
> JavaBeans and JAR files on Tomcat 3.2.1. When Tomcat is started, it unpacks
> the war file correctly with everything in its place. However, part of the
> initialization process contained in the index.jsp is to attempt to read a
> properties file to obtain the DB connection info. It is the attempt to read
> this properties file that causes the NullPointerException. This only happens
> when Tomcat has expanded the WAR file. If Tomcat is stopped and started
> again, everything works, the property files are found and read.

I haven't tried this from a WAR file, but you could use the following
instead:

	application.getResourceAsStream( "/WEB-INF/db.props" );

Where "application" is the ServletContext implicit object.

-- 
 `O O'  | Nick.Holloway@pyrites.org.uk
// ^ \\ | http://www.pyrites.org.uk/

Mime
View raw message