You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Raymond <pp...@hotmail.com> on 2005/03/12 14:46:03 UTC

Wrong date / calendar after server has been running for long time

Hi,

We are using Tomcat 5.0.28 running a Tapestry website for our company. A weird bug occurred and I am not sure if it's Java or Tomcat bug.

Logging (new Date()).toString() or Calendar.getInstance().getTime().toString() normally returns the correct clock value at the timezone of our server (HKT or GMT+8). But when the server has continuously run say 2 days the log message showed that the toString() values of all Date objects changed to UTC and the time values are all offset by -8 hours.

This caused very serious problem for our production application because we very much depends on the server clock to do various automatic scheduled jobs and logging user behaviours at different times.

When the server has been restarted everything gets back to normal until pehaps 2 days later when it'd suddenly go wild again. I tried to set the default TimeZone but it seems to produce other unexpected effects in complicated ways such as affecting some date-sensitive 3rd party components (which we cannot make changes to) breaking many datetime dependent operations in them.

I never encountered similar errors with non-web Java apps so I suspect this is more likely a Tomcat bug. But please correct me if I am wrong.

Thanks a lot for help.
Raymond