> -----Urspr�ngliche Nachricht-----
> Von: Peng Tuck Kwok [mailto:[EMAIL PROTECTED]
> Gesendet: Mittwoch, 21. Juli 2004 16:10
> An: Struts Users Mailing List
> Betreff: Re: OT: Problems with classpath under tomcat 5
>
> Are you sure if it is not looking your properties file in the
> classpath of the webapp ?
Yes, because it would find them there.
> When you say everything works fine until tomcat 5 is used , does the
> console print out any error ? Also how do you know it is searching in
> shared classes ?
Yes, the console prints out our debug output:
xyz.properties doesn't exist, skipping update for [EMAIL PROTECTED]
if you read the code, you'll find that it's also trying to locate the '.' directory.
In all other environments it's webapps/mywebapp/WEB-INF/classes
in tomcat5 it's .../common/classes (which is one of the pathes according to
tomcat5 class loader faq). (Sorry, I wrote shared/classes in my first mail, it was
common/classes, but it doesn't really matter, because both aren't the right ones :-)
Regards
Leon
>
> On Wed, 21 Jul 2004 15:45:01 +0200, Rosenberg, Leon
> <[EMAIL PROTECTED]> wrote:
> > 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);
> >
> > }
> >
> > }
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]