LoginSignup
4

More than 5 years have passed since last update.

Elastic BeanstalkのtomcatでJVMのタイムゾーンにハマった

Posted at

Tomcatを使ったら時間がUTCに

デフォルトのElastic BeanstalkのTomcatをつかってJavaを実行すると、
時間がUTCの時刻になってしまい、JSTに変更する必要が発生した。。

カスタムAMIでシステムクロックを日本時間に

システムクロックを日本時間に変更して、カスタムAMIを作成後、
Elastic Beanstalkで使えるようにしたが、、、、、、
dateコマンドでは日本時間になったのに、、、、、、、
javaではUTCになってしまう。。。。(´・ω・`)
つまり、JVMのタイムゾーンがUTCのままになってしまっている。。。。

Elastic Beanstalkの設定

EBの「Configuration」→「Software Configuration」→「JVM command line options」に
「-Duser.timezone="Asia/Tokyo"」と入力
こんな感じ↓
JVM_command_line_options.png
一番下の「Apply」をクリック
特にインスタンスの再デプロイ無しで設定が変更される!

完了!(๑•̀ㅁ•́๑)✧

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4