Hi, 

 

it's a bit OT but maybe some of you had a similar problem shortly and
can help.

 

We have a configuration component which configures other components of
the application out of property files. The property files lies in the
'classes' directory of the application. Everything works fine until we
use tomcat 5 (5.0.19). 

In tomcat 5 the ClassLoader doesn't search for our property files in
webapps/mywebapp/WEB-INF/classes. Instead it seems to search in
shared/classes which imho should be done after the private webapp
classpath has bin searched through. 

 

As I said before it works fine with standalone applications and with
resin. 

 

Any ideas?

 

Regards

Leon

 

P.S. 

 

The files are there and we have the rights to read them.

 

 

P. P.S. the code:

 

      private void updateConfigurable(IConfigurable target, boolean
dontcheck){

            String fileName =
target.getConfigurationName()+".properties";

            

            log.debug("Checking for "+"/"+fileName);

            log.debug("Approx. checking in
"+target.getClass().getResource("/."));

            

            URL u = target.getClass().getResource("/"+fileName);

            if (u==null){

                  log.error(fileName+" doesn't exist, skipping update
for "+target);

                  return;

            }

            

            if (!dontcheck){

                  log.debug("Checking "+target);

                  File f = new File(u.getFile());

                  long lastModified = f.lastModified();

                  long timestamp = getTimestamp(target);

                  if (lastModified<timestamp)

                        return;

                  log.debug("filename has been updated.");

                        

            }

            

            log.debug("updating "+target);

            try{

                  Properties p = new Properties();

 
p.load(target.getClass().getResourceAsStream("/"+fileName));

                  target.notifyConfigurationStarted();

                  Enumeration keys = p.keys();

                  while(keys.hasMoreElements()){

                        String key = (String)keys.nextElement();

                        String value = p.getProperty(key);

                        target.setProperty(key, value);

                  }

                  target.notifyConfigurationFinished();

                  setTimestamp(target);

            }catch(Exception e){

                  log.error("updateConfigurable", e);

            }

            

            

      }

 

 

Reply via email to