Discussion:
Websphere Application Server v6.1 - Time Zone issues
(too old to reply)
a***@gmail.com
2007-08-28 05:39:07 UTC
Permalink
We have an application that extensively makes use of the java.util.Date objects for doing comparison of events etc. To have uniformity in the Time Zone of all the Date objects in the application, the startup module of the application sets up the Time Zone of the host JVM to GMT, using java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("GMT")). The Time Zone for the host machine/OS can be different from GMT. Also, this is the only place in the application code where the Time Zone for the host JVM is set. Ideally, after this step, any new java.util.Date object created in the application should have its TimeZone set to GMT. Application code assumes this fact, and does not check for the TimeZone for each new Date object created in the system.

The application has been running without any problem on Websphere Application Server 6.0.2.13 for over a year now. Recently, we have migrated to WAS 6.1.0.9 (without any changes to the code that uses Dates and TimeZones). We have observed some issues in WAS 6.1 w.r.t the treatment of java.util.TimeZone. The application still sets up the TimeZone to GMT at the time of startup, but when WAS 6.1 processes requests submitted on JSPs, it seems to be changing the TimeZone of the host JVM to the locale TimeZone (set for the OS of the host machine), and does not revert it back to GMT later. There is a work-around in appropriately setting the property user.timezone for the WAS profile hosting the application, but my question is that why should WAS change the TimeZone of the host JVM to locale (and then does not revert it back to the original), when the application explicitly sets it to GMT at startup? Is it not making application dependent on the Application Server properties? Besides, the application has been running fine without making any use of Application Server specific feature on Application Servers ranging from JRun, Apache Tomcat to Websphere Application Server 6.0!

Any insight would be greatly appreciated.

Thanks,
Abhi
Ben_
2007-08-31 13:34:00 UTC
Permalink
If it used to work but doesn't anymore and you can show it, you could easily
open a PMR and have IBM Support's view on this.

I don't see who outside IBM could answer this.
a***@gmail.com
2007-09-04 09:35:09 UTC
Permalink
Thanks for the input, Ben.

As for proving the issue, I have written a small (and dirty) JSP and associated Java class that demonstrates the issue with WAS 6.1.0.9. The setup is simple. The Java class sets up the TimeZone of the host JVM to GMT, and later it just creates new Date objects, and prints the TimeZone of the newly created objects. We have tested this on WAS 6.0.2.13, and found that once the TimeZone of the host JVM is set to GMT, all the newly created Date objects have the TimeZone set to GMT. However, with WAS 6.1.0.9, the TimeZone changes back to the locale TimeZone, after the JSP has been re-processed by the JSP engine of WAS.

We have tested this setup with WAS 6.0.2.13, WAS 6.1.0.9, and JRun4. The setup works without any TimeZone problem on WAS 6.0.2.13 and JRun4, without doing any server specific setting. However, it fails for WAS 6.1.0.9, if the user.timezone (an App Server specific property)is not set to GMT. Below are the logs of our tests.

I will now try to raise a ticket with IBM Support team, once I figure out the process for that :-).

Thanks,
Abhi

TEST LOGS
---------
=========================================================
TEST CASE RESULTS WITH WAS 6.1.0.9: (Works incorrectly)

Welcome to the TimeZone Test - The locale Time Zone is : Mountain Standard Time
The new Date objects right now is : Mon Sep 03 08:51:53 MDT 2007

Welcome to the TimeZone Test - The locale Time Zone is : Mountain Standard Time
Startup Completed - Now the new Date is : Mon Sep 03 14:52:18 GMT 2007
[9/3/07 8:52:18:939 MDT] 00000022 SystemOut O A new Date object just BEFORE the Startup : Mon Sep 03 08:52:18 MDT 2007
[9/3/07 8:52:18:940 MDT] 00000022 SystemOut O A new Date object just AFTER the Startup : Mon Sep 03 14:52:18 GMT 2007

Welcome to the TimeZone Test - The locale Time Zone is : Mountain Standard Time
Retest Completed - Now the new Date is : Mon Sep 03 08:52:57 MDT 2007
[9/3/07 8:52:57:548 MDT] 00000023 SystemOut O A new Date object just AFTER the reTest : Mon Sep 03 08:52:57 MDT 2007

======================================================
TEST CASE RESULTS WITH WAS 6.0.2.13: (Works correctly)

Welcome to the TimeZone Test - The locale Time Zone is : India Standard Time
The new Date objects right now is : Mon Sep 03 15:20:59 IST 2007

Welcome to the TimeZone Test - The locale Time Zone is : India Standard Time
Startup Completed - Now the new Date is : Mon Sep 03 09:51:24 GMT 2007
[9/3/07 15:21:24:368 IST] 00000019 SystemOut O A new Date object just BEFORE the Startup : Mon Sep 03 15:21:24 IST 2007
[9/3/07 15:21:24:369 IST] 00000019 SystemOut O A new Date object just AFTER the Startup : Mon Sep 03 09:51:24 GMT 2007

Welcome to the TimeZone Test - The locale Time Zone is : India Standard Time
Retest Completed - Now the new Date is : Mon Sep 03 09:51:59 GMT 2007
[9/3/07 15:21:59:650 IST] 00000019 SystemOut O A new Date object just AFTER the reTest : Mon Sep 03 09:51:59 GMT 2007
=======================================================
TEST CASE RESULTS WITH WAS 6.1.0.9, and 'user.timezone' variable set to GMT: (Works correctly)

Welcome to the TimeZone Test - The locale Time Zone is : Greenwich Mean Time
The new Date objects right now is : Mon Sep 03 18:32:02 GMT 2007

Welcome to the TimeZone Test - The locale Time Zone is : Greenwich Mean Time
Startup Completed - Now the new Date is : Mon Sep 03 18:34:58 GMT 2007
[9/3/07 18:34:58:404 GMT] 0000002b SystemOut O A new Date object just BEFORE the Startup : Mon Sep 03 18:34:58 GMT 2007
[9/3/07 18:34:58:405 GMT] 0000002b SystemOut O A new Date object just AFTER the Startup : Mon Sep 03 18:34:58 GMT 2007

Retest Completed - Now the new Date is : Mon Sep 03 18:35:44 GMT 2007
[9/3/07 18:35:44:046 GMT] 0000002b SystemOut O A new Date object just AFTER the reTest : Mon Sep 03 18:35:44 GMT 2007
Ben_
2007-09-04 16:07:04 UTC
Permalink
Post by a***@gmail.com
I will now try to raise a ticket with IBM Support team, once I figure out
the process for that :-).
See "Report problems" at
http://www-306.ibm.com/software/webservers/appserv/was/support/.
If relevant, note that you entitle for support during the trial period.
Loading...