[英]Java not using the correct timezone
My company has a web application deployed to an Oracle WebLogic server. 我公司的Web应用程序已部署到Oracle WebLogic服务器。 We are working on upgrading to WebLogic 12c and upgrading the application from Java 1.5 to 1.7.0_15.
我们正在努力升级到WebLogic 12c,并将应用程序从Java 1.5升级到1.7.0_15。
When starting the application server, we were getting the following error: 启动应用程序服务器时,出现以下错误:
<Jun 6, 2017 12:09:31 PM EDT> <Error> <Deployer> <BEA-149205> <Failed to initialize the application "SIMPLeBDataSource" due to error weblogic.application.ModuleException: weblogic.common.ResourceException: weblogic.common.ResourceException: Could not create pool connection for datasource 'SIMPLeBDataSource'. The DBMS driver exception was: ORA-00604: error occurred at recursive SQL level 1
ORA-01882: timezone region not found
weblogic.application.ModuleException: weblogic.common.ResourceException: weblogic.common.ResourceException: Could not create pool connection for datasource 'SIMPLeBDataSource'. The DBMS driver exception was: ORA-00604: error occurred at recursive SQL level 1
ORA-01882: timezone region not found
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:350)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:175)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:170)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
Truncated. see log file for complete stacktrace
Caused By: weblogic.common.ResourceException: weblogic.common.ResourceException: Could not create pool connection for datasource 'SIMPLeBDataSource'. The DBMS driver exception was: ORA-00604: error occurred at recursive SQL level 1
ORA-01882: timezone region not found
at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:360)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1320)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1237)
at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:240)
at weblogic.jdbc.common.internal.ConnectionPool.doStart(ConnectionPool.java:1624)
Truncated. see log file for complete stacktrace
>
We found that adding -Duser.timezone='Canada/Eastern'
to the server start parameters fixed the problem. 我们发现将
-Duser.timezone='Canada/Eastern'
到服务器启动参数可以解决该问题。 However, the server logs and log4j logs are not recording the correct timestamp; 但是,服务器日志和log4j日志未记录正确的时间戳; they are an hour behind.
他们落后一个小时。
I added TimeZone localTimeZone = TimeZone.getDefault();
我添加了
TimeZone localTimeZone = TimeZone.getDefault();
to the code and logged localTimeZone.toString() and got sun.util.calendar.ZoneInfo[id="GMT-05:00",offset=-18000000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
. 到代码并记录localTimeZone.toString()并
sun.util.calendar.ZoneInfo[id="GMT-05:00",offset=-18000000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
。
Eastern Standard Time is GMT-5 and we are currently in Daylight Savings, which makes it GMT-4, so it seems like it's using the specified java startup parameter but not recognizing that it's supposed to be in DST. 东部标准时间是GMT-5,而我们目前处于夏令时,因此将其设置为GMT-4,因此它似乎正在使用指定的Java启动参数,但没有意识到它应该在DST中。 Is there a way to specify DST in the start parameters?
有没有一种方法可以在启动参数中指定DST?
Setting user.timezone
is the correct procedure. 设置
user.timezone
是正确的过程。 If its still not working, try upgrading to the latest jdk, say jdk 7 update 131 or 141. If that is not an option, try the "Timezone Updater tool". 如果仍然无法正常运行,请尝试升级到最新的jdk,例如说jdk 7更新为131或141。如果不是这样,请尝试使用“时区更新程序工具”。 You can find more details here : http://www.oracle.com/technetwork/java/javase/dst-faq-138158.html
您可以在这里找到更多详细信息: http : //www.oracle.com/technetwork/java/javase/dst-faq-138158.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.