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

Jeff Larsen jlar310 at gmail.com
Sun Feb 10 01:37:06 UTC 2008


On Feb 8, 2008 6:18 PM, Isaac Gonzalez <igonzalez at autoreturn.com> wrote:
> 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.

This is definitely a Tomcat issue. You should take it to a Tomcat
list. I can tell you what I found though:

I ran Tomcat in a debugger to locate the code that generates the
directory listing text. In the Tomcat 5.5.23 source code in class
org.apache.naming.resources.ResourceAttribute, the timezone for the
date formatter is hard coded as GMT. Nice, huh?

Maybe there's a way to manipulate that, but I don't know it. The
Tomcat developers probably don't care much about it because Tomcat is
seldom used to serve static content.

But at least you can stop letting the time zone configuration drive you crazy...

--
Jeff



More information about the CentOS mailing list