Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Timezone in Tomcat

How can I change the timezone in Tomcat? The timezone used by one of the webapps (Solr) is not right (compared to MySQL timestamps), and I think changing Tomcat's timezone will help. Thanks!

like image 455
Nyxynyx Avatar asked Aug 24 '12 15:08

Nyxynyx


2 Answers

Here is what I add at beginning of catalina.sh (after shabang) to change tomcat's timezone:

TOMCAT_TIMEZONE="-Duser.timezone=Europe/Budapest"
CATALINA_OPTS="$CATALINA_OPTS $TOMCAT_TIMEZONE"

And don't forget to restart tomcat to take effect.

like image 94
user218867 Avatar answered Nov 08 '22 13:11

user218867


As said Eric Wang you may use

TOMCAT_TIMEZONE="-Duser.timezone=Europe/Budapest"
CATALINA_OPTS="$CATALINA_OPTS $TOMCAT_TIMEZONE"

but on CentOS server I didn't find catalina.sh, instead of that I added these variables to /etc/sysconfig/tomcat6, and that's works!

like image 29
novicef Avatar answered Nov 08 '22 13:11

novicef