-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Raghu,

On 10/10/2009 4:04 AM, raghu gs wrote:
> I have installed Tomcat 6.0.20 using binary tarball in JDK 1.6.0.16 running
> CentOS 5,3 x64 Server.

Use this class for reference:

import java.util.TimeZone;

public class TimeZoneTest
{
    public static void main(String[] args)
    {
        System.out.println("user.timezone="
            + System.getProperty("user.timezone"));
        System.out.println("TimeZone.getDefault="
            + TimeZone.getDefault());
    }
}

On my system, this is the output with all defaults:

$ java TimeZoneTest
user.timezone=
TimeZone.getDefault=sun.util.calendar.ZoneInfo[id="America/New_York",offset=-18000000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/New_York,offset=-18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]

> We have tried the following methods to force tomcat to use the Asia/Calcutta
> as timezone.
> 
> 1) Created an environment variable called TZ and assigned it correct
> timezone.

$ TZ=Asia/Calcutta java TimeZoneTest
user.timezone=
TimeZone.getDefault=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null]

> 2) Setting the correct timezone in catalina.sh via JAVA_OPTS="$JAVA_OPTS
> -Duser.timezone=Asia/Calcutta"

$ java -Duser.timezone=Asia/Calcutta TimeZoneTest
user.timezone=Asia/Calcutta
TimeZone.getDefault=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null]

> 3) Our linux server uses Asia/Calcutta as Timezone,
> evidence clock command's output is  Sat 10 Oct 2009 01:18:44 PM IST
>  -0.502713 seconds

What configuration effects this timezone setting? TZ environment
variable? Something else?

> 4) We have tried setting IST as timezone in catalina.sh too. but it didn't
> work.

$ TZ=IST java TimeZoneTest
user.timezone=
TimeZone.getDefault=sun.util.calendar.ZoneInfo[id="IST",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null]

> 5) Java runtime is correctly running in Asia/Calcutta time, as a simple java
> program revealed it.

Good.

> We have certainly not forced to use GMT as timezone in our tomcat
> webapps code, as the same code is shared between multiple servers, In
> those servers timezone information is being correctly inherited.

What does your server report if you ask for
System.getProperty("user.timezone") and TimeZone.getDefault() while
Tomcat is running? What leads you to believe that either the JVM or
"Tomcat" is not running with the right TimeZone?

> Please help me to resolve this issue else i have to reformat the hard disk.

That seems like a drastic technique.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrQiqwACgkQ9CaO5/Lv0PD9ewCfZLn3mzh66g0xgifCwR0WRRrl
btcAn1Wuk0u5WKnxxpeala8NxSiC+oDK
=Fg2p
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to