[CentOS] Java not seeing timezone/tomcat displaying times in GMT

Sat Feb 9 00:18:05 UTC 2008
Isaac Gonzalez <igonzalez at autoreturn.com>

I'm setting export CATALINA_OPTS= "Duser.timezone=America/Los_Angeles"
in my init.d script that starts up the tomcat(haven't set it in
$CATALINA_HOME/bin/setenv.sh)...but will try that as well ....i wrote a
simple java function that print the date, and when I call java foo, it
prints the correct date format. I haven't tried the jsp page, but will
also try that...seems as if tomcat is ignoring everything I set.

-----Original Message-----
From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On
Behalf Of Jeff Larsen
Sent: Friday, February 08, 2008 8:46 AM
To: CentOS mailing list
Subject: Re: [CentOS] Java not seeing timezone/tomcat displaying times
in GMT

On Feb 7, 2008 9:12 PM, Isaac Gonzalez <igonzalez at autoreturn.com> wrote:
> Any ideas how to force tomcat to display directory listing in local
time
> zone format of my cent box instead of GMT.
>
>
> I tried all suggestions here:
>
http://marvinlee.wordpress.com/2008/02/01/java-timezone-setting-in-cento
> s-for-asiakuala_lumpur/
>
> except I use PST8PDT for the timezone....i believe I'm using this as
my
> timezone as this is what appears in /etc/localtime file. When using
date
> command it displays in correct format from bash prompt.

I don't know exactly what PST8PDT is, but Java prefers the full names
for time zones like US/Central or US/Pacific

Have you tried something like -Duser.timezone=US/Pacific on the java
command line that launches tomcat. You can add that to JAVA_OPTS in
$CATALINA_HOME/bin/setenv.sh

Is your tzdata package in CentOS up to date?

Then again, I haven't done much with directory listings in Tomcat, so
there may be a different issue at work here. Can you create a simple
JSP page that writes java.util.TimeZone.getDefault().toString() and
see what you get?

--
Jeff
_______________________________________________
CentOS mailing list
CentOS at centos.org
http://lists.centos.org/mailman/listinfo/centos