tomcat-users mailing list archives

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



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/");
  InputStream istream = url.openStream();
} 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:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message