Monday, November 7, 2011

How to resolve 'ORA-01882: timezone region not found' when starting WSO2 product servers with Oracle

Have you ever come across the below issue when starting any of the WSO2
Carbon servers,pointing to an Oracle database WITH ojdbc6.jar?Caused by: org.wso2.carbon.user.core.UserStoreException:
Database Error - Cannot create PoolableConnectionFactory
(ORA-00604: error occurred at recursive SQL level 1ORA-01882: timezone region
not found) at org.wso2.carbon.user.core.claim.dao.ClaimDAO.getDialectCount
(ClaimDAO.java:168) at org.wso2.carbon.user.core.common.DefaultRealm.
populateProfileAndClaimMaps(DefaultRealm.java:278) at
org.wso2.carbon.user.core.common.DefaultRealm.init(DefaultRealm.java:109)
at org.wso2.carbon.user.core.common.DefaultRealmService.initializeRealm
(DefaultRealmService.java:240) ... 17 moreCaused by:
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory
(ORA-00604: error occurred at recursive SQL level 1ORA-01882:
timezone region not found) at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory
(BasicDataSource.java:1549) at org.apache.commons.dbcp.BasicDataSource.createDataSource
(BasicDataSource.java:1388) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.wso2.carbon.user.core.claim.dao.ClaimDAO.getDialectCount(ClaimDAO.java:158)
... 20 more
Well, if you have, all you have to do is, set the below JAVA property
in the terminal that you are running the server on, before starting the
server (+05:30 if you are in Sri Lanka. May vary from the location that
you are located at).export JAVA_OPTS="-Duser.timezone='+05:30'" The above setting will only take effect to the current terminal. Therefore, if you need to set this property permanently, all you have to do is, add it to the wso2server.sh as a new JAVA_OPT property (See below).