Updating the time zone/daylight saving time information in Java application servers and Apache HTTP server
search cancel

Updating the time zone/daylight saving time information in Java application servers and Apache HTTP server

book

Article ID: 342921

calendar_today

Updated On:

Products

VMware Support Only for Apache HTTP Support Only for Apache Tomcat

Issue/Introduction

Running Java application servers such as tc Server, ASF Tomcat, WebLogic, etc with Sun JRE or JDK and Apache HTTP Server are often used with applications that are time zone sensitive and must be updated with changes in time zone specifications, such as the change to daylight saving time (DST) that went into effect in USA time zones in 2007. This article provides more information on the source of time zone specifications for these servers and the VMware products that are using Sun JRE or JDK.

Environment

Apache Tomcat 6
Apache Tomcat 5.5
VMware vFabric Enterprise Ready Server 4
VMware vFabric tc Server 2.0
Apache Tomcat 7
Apache HTTP Server 2.2
VMware vFabric tc Server 2.6
Apache HTTP Server 2.0
VMware vFabric Web Server 5.0
VMware vFabric tc Server 2.1
VMware vFabric tc Server 2.5

Resolution

Time zones are determined by your operating system or Java and these may have to be updated for time zone changes, including changes to daylight saving time.

Apache HTTP Server

Apache HTTP server derives its date and time information from the underlying operating system. To maintain compliance with time zone changes, you must ensure that your operating system is updated. Contact your operating system vendor to obtain any necessary patches. You need not make changes to HTTPD. This is also true for Perl, PHP, and other scripting languages that get the date/time info from the operating system.

Java Application Servers using Sun JRE or JDK

Java application servers such as tc Server, ASF Tomcat and etc that are using Sun JRE or JDK (bundled with JRE) dependent on Sun JRE timezone data files for information on DST. The timezone data changes over the years and you'll need make sure your JRE timezone data is up-to-date. Note that Sun JRE maintains it own timeszone data files in ../jre/lib/zi folder that is different from the Operating System timezone data, so updating the OS timezone will have no affect on the JRE timezone data.

For Sun/Oracle JVM users, you may update to the latest JDK / JRE to get a recent set of timezone data. Although the latest JDK / JRE release is not guaranteed to contain the most recent timezone data and you should verify the timezone data information with latest version of tzupdater tool.

For Sun/Oracle JVM users who are unable to update to the latest JDK / JRE and need the absolute latest version of timezone data can use Oracle's tzupdater tool to update the timezone data. This tool supports JDK / JRE version 1.4.0 and later releases.

Note:
You don't need to make changes to application servers only updating the timezone data files on JRE (Hint: JRE maintains it own version of time zone data repository that get used by the JVM).

How to update Sun JRE timezone data using tzupdater tool:

1) You'll need the latest version of the timezone updater (tzupdater.jar) tool, it can be download from here http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html#timezone

Usage: java -jar tzupdater.jar options

options:
-h, --help Print this message and exit.
-V, --version Print tool version, tzdata version nos. of JRE and embedded one and exit.
-u, --update Update time zone data.
-f, --force Force to update tzdata.
-bc, --backwardcompatible Keep JDK1.1 time zone ID compatibility. Requires -u, -f or -t.
-t, --test Perform verification tests and exit.
-v, --verbose Display detailed messages to stdout.

2) Before running the tzupdater tool to update timezone data, you should stop all the running JVM instances of the version of JRE that you will be updating. Cached instances of timezone data might exist in running JRE software processes if you do not shut down the JRE software before running the tool. Otherwise you'll need to restart all running JVM instances to recache the updated timezone data after the TZupdater tool has completed its update.

3) Check the current jre1.6.0_33 timezone data version to see if it needs to be update:

>jre1.6.0_33/bin/java -jar tzupdater.jar -V
tzupdater version 1.3.53-b01
JRE time zone data version: tzdata2012c
Embedded time zone data version: tzdata2012j

>jre1.6.0_33/bin/java -jar tzupdater.jar -t
/data/tzdata2012j.test:1566: test failed: America/Havana
/data/tzdata2012j.test:1570: test failed: America/Havana
...
/data/tzdata2012j.test:5353: test failed: Pacific/Apia
/data/tzdata2012j.test:5356: test failed: Pacific/Apia
/data/tzdata2012j.test:5358: test failed: Pacific/Fakaofo

Validation tests failed.


4) We need to update the timezone data version from tzdata2012c to tzdata2012j:

> jre/1.6.0_33/bin/java -jar tzupdater.jar -v -u
java.home: /data/opt2/java/64/jre1.6.0_33
java.vendor: Sun Microsystems Inc.
java.version: 1.6.0_33
JRE time zone data version: tzdata2012c
Embedded time zone data version: tzdata2012j
Extracting files... done.
Renaming directories... done.
Validating the new time zone data... done.
Time zone data update is complete.

5) Verify jre1.6.0_33 timezone data is updated to tzdata2012j:

> jre/1.6.0_33/bin/java -jar tzupdater.jar -V
tzupdater version 1.3.53-b01
JRE time zone data version: tzdata2012j
Embedded time zone data version: tzdata2012j

6) Run verification tests:

> jre/1.6.0_33/bin/java -jar tzupdater.jar -t
java.home: /data/opt2/java/64/jre1.6.0_33
java.vendor: Sun Microsystems Inc.
java.version: 1.6.0_33
JRE time zone data version: tzdata2012j
Embedded time zone data version: tzdata2012j
Validating the time zone data
Validation complete

For more information, see Timezones, Daylight Savings, and the Sun TZupdater for the Java Runtime Environment (JRE).
Note: The preceding links were correct as of February 08, 2012. If you find a link is broken, provide feedback and a VMware employee will update the link.


Additional Information

What is differences between JVM, JRE and JDK?

JVM
(Java Virtual Machine) is a virtual machine that runs your Java bytecode and it uses Java class libraries packaged in jar files and other supporting files that bundled with JRE. When JVM started, it uses the following class loaders to dynamically load Java classes:
  1. Bootstrap class loader - Loads core Java libraries in native code locate in jre/lib path.
  2. Extensions class loader - Loads extension classes and various security functions locate in jre/lib/ext path.
  3. System class loader - Loads application classes which map to system $CLASSPATH variable.
  4. User-defined class loader - User written custom class loader. For instance, Tomcat has it own custom class loader for loading classes from WAR file etc.
JRE (Java Runtime Environment) is bundled with JVM, Java API, class libraries and other supporting files required to run applets and applications written in Java programning language. It is a subset of JDK that does not come with development tools.

JDK
(Java Development Kit) is bundled with JRE with extra contents and development tools like compiler, debuggers, and etc.


References: