Monday, January 11, 2016

How to troubleshoot and fix "ORA-01882 timezone region not found" while creating WebLogic data source


While creating a data source in WebLogic you get the error "ORA-01882 timezone region not found" while saving the new configuration. 


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:


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/ 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}${WLS_POLICY_FILE} ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}"



echo "Redirecting output from WLS window to ${WLS_REDIRECT_LOG}"


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.  

1 comment: