tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Sand" <rs...@vgalleries.com>
Subject classloader caching resources in 4.0?
Date Wed, 02 Jan 2002 17:44:25 GMT
Hi all,

Has anyone seen this problem I describe below?  Tomcat 4 seems to be caching
resouce files the way it caches classes, requiring a restart of the
application every time I change a properties file.  Tomcat 3 (and other
servlet engines) did not behave this way- every time I did a
getResourceAsStream it would re-open the file.  Is this new behavior correct
or a bug?

Thanks for any help!

-Richard

----- Original Message -----
> I have a .properties file that I use for my application configuration that
I
> keep in WEB-INF/classes.  I use
> getClass().getResourceAsStream("/myfile.properties") from within a bean to
> load the properties into a static hashtable, and I have a control servlet
> that can tell the bean to reload the file.  This just allows me to edit
the
> properties without having to start and stop the application (which was a
> more painful process pre-Catalina).
>
> Now that I've switched from 3.2.3 to 4.0.1, what I'm seeing is that my
> changes to the properties file are not being picked up when I reset my
bean.
> I've traced through everything, and determined that my subsequent calls to
> getResourceAsStream are still opening the original file, even though I've
> modified and saved it.  Its as if the classloader is treating the resource
> as a class, and it is loading it once and keeping it around, so I need to
> reload the application to reload the resource.
>
> This was not the behavior under 3.x, so my question is, is this proper
> behavior in 4.x, and if so, is there a workaround?
>
> Thanks for any replies!
>
> Best regards,
>
> Richard


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message