1
nopy 2015 年 8 月 19 日 把系统时间加 8 个小时。
|
2
unique 2015 年 8 月 19 日 重新装一次 JDK
|
4
tianice 2015 年 8 月 19 日 |
5
phx13ye 2015 年 8 月 19 日 硬件时间同步成 UTC , 自己的环境时区随便怎么搞
|
6
beyondsoft 2015 年 8 月 19 日 设置这个关键变量试试
TZ='Asia/Shanghai'; export TZ |
8
KentY 2015 年 8 月 19 日 你启动你的 server 的时候是不是有个 java_opts -Duser.timezone=xxxx ? 导致你的 server 运行在 xxxx timezone., 你的程序里 new Date ()就是那个时区的了.
|
10
blackboom OP @unique
@tianice @phx13ye @beyondsoft @KentY 感谢各位 在 tomcat 中添加了 JAVA_OPTS="-Duser.timezone=GMT+08" 时间恢复正常 Tomcat 程序时间是正常了,但不是根本的解决办法,其他 JAVA 程序依旧时间不正常 |
11
kn007 2015 年 8 月 19 日
LS 正解
|
12
phx13ye 2015 年 8 月 19 日 |
14
anexplore 2015 年 8 月 19 日 看一下 java.util.TimeZone 的获取 timezone 的源码吧,
private static synchronized TimeZone setDefaultZone () { TimeZone tz; // get the time zone ID from the system properties String zoneID = AccessController.doPrivileged ( new GetPropertyAction ("user.timezone")); // if the time zone ID is not set (yet ), perform the // platform to Java time zone ID mapping. if (zoneID == null || zoneID.isEmpty ()) { String country = AccessController.doPrivileged ( new GetPropertyAction ("user.country")); String javaHome = AccessController.doPrivileged ( new GetPropertyAction ("java.home")); try { zoneID = getSystemTimeZoneID (javaHome, country ); if (zoneID == null ) { zoneID = GMT_ID; } } catch (NullPointerException e ) { zoneID = GMT_ID; } }} 。。。。。。。。。。 } |
15
aaronmix 2015 年 8 月 20 日 JDK 版本多少?
|
16
codeyung 2015 年 8 月 20 日 还是 linux 系统时间要改 UTC 试试 然后 tomcat 启动里添加既可
|
17
sovalvo 2015 年 8 月 20 日 我是来看一楼的😄
|