tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "petra staub" <cal...@hotmail.com>
Subject Re: Reading properties file from ClassPath (ServletContextListener)
Date Thu, 01 Aug 2002 14:11:48 GMT
Sorry for the uncomplete first email...my mailer was just to
fast for me... :-)
Again...

----------------------------------------------------------------

Hi,

I currently dont understand the following:

I have a registered class as a ServletContextListener.
At application start I want to read a Properties file
from the classpath, doing the following:

myProps = new Properties();
try {
  URL url = ClassLoader.getSystemResource("com/foo/My.properties");
  InputStream istream = url.openStream();
  myProps.load(istream);
} catch (Exception exp) {
  // do something
}


Unfortunately, the routine never finds the Properties file and give
back url==null...

If I create a main class in the same package, doing exactly the same,
it works. It seems to have to do with the ServletContextListener...

Is this a ClassLoader effect or am I doing something wrong?
Can someone explain me what is going on?

Thanks a lot!



_________________________________________________________________
Mit MSN Fotos können Sie kinderleicht Ihre Fotos ausdrucken und Freunden zur 
Verfügung stellen: http://photos.msn.de


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message