tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Gnass <felix.gn...@riotfamily.org>
Subject Re: hotdeploy of war files results in static variable being null
Date Wed, 23 Jul 2008 16:26:01 GMT
Hi,

as far as I know Tomcat's WebappClassloader sets final static references 
to null upon re-deployments to prevent memory leaks. The following page 
describes what's happening: 
http://wiki.apache.org/jakarta-commons/Logging/StaticLog

One possible solution would be not to use static loggers.

Best regards,
-Felix


Fu-Tung Cheng wrote:
> Hi,
>
> I sometime hotdeploy my war file to tomcat 6.0.16.  I have noticed that a static variable
in one of my classes then ends up being null.
>
> The variable is initialized as follows:
>
> private static Logger logger = Logger.getLogger(MyClass.class);
>
> and then used below in a method:
>
> public void mymethod(String mystring) {
>   logger.info(mystring + " did something");
> }	
>
> This is a little annoying as I then need to restart the server for this class to work
properly.  
>
> Is this a known bug?  I could probably create a little sample war file to demonstrate
the issue but I don't want to go through that if you guys already know about the issue.
>
> Thanks,
>
> Fu-Tung
>
>
>       
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message