Symptoms
While creating a data source in WebLogic you get the error "ORA-01882 timezone region not found" while saving the new configuration.
Troubleshooting
This troubleshooting was performed on a Red Hat Linux 6.6 server running WebLogic 12.1.3
Finding the timezone used by the JVM
Even if the user account running WebLogic does not have a TZ environment variable set, the JVM will pickup a timezone as specified by the sysconfig clock on Linux. By running $JAVA_HOME/bin/jvisualvm you will be able to find out which timezone it is using by looking for the user.timezone property in System properties:
In my case this was originally set to Etc/UTC.
Which timezones are supported by the Oracle database
Log on to the database to which you attempted to create a data source, and then run the following query:
SELECT * FROM V$TIMEZONE_NAMES ORDER BY 1;
In my case there was no such thing as TZNAME = Etc/UTC. But of course just UTC was a valid value.
Force WebLogic to use UTC timezone
Edit $DOMAIN_HOME/bin/startWebLogic.sh and go to the bottom of the file where the commands to startup WebLogic reside. After each of the three ${MEM_ARGS} add -Dtimezone=UTC. After your change the section will look like this:
echo "starting weblogic with Java version:"
${JAVA_HOME}/bin/java ${JAVA_VM} -version
if [ "${WLS_REDIRECT_LOG}" = "" ] ; then
echo "Starting WLS with line:"
echo "${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} -Duser.timezone=UTC -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WLS_POLICY_FILE} ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}"
${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} -Duser.timezone=UTC -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WLS_POLICY_FILE} ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}
else
echo "Redirecting output from WLS window to ${WLS_REDIRECT_LOG}"
${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} -Duser.timezone=UTC -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WLS_POLICY_FILE} ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS} >"${WLS_REDIRECT_LOG}" 2>&1
fi
Finally restart WebLogic.
Verify that the JVM is using the new timezone
The quick way to check it is of course "ps -ef | grep timezone" and make sure there is one hit per managed server plus the AdminServer.
Of you can check with JVisualVM as explained above.
It worked. Thanks
ReplyDelete