WSO2 ESB : How to fix “Failed to start new registry transaction” error.

When configuring WSO2 ESB with its embedded registry pointing to an Oracle RAC instance, sometimes you may run into connection issues with the RAC instance, with the following error trace.

ERROR {org.wso2.carbon.registry.core.dataaccess.TransactionManager} - Failed to start new registry transaction. {org.wso2.carbon.registry.core.dataaccess.TransactionManager}
java.sql.SQLException: Connection oracle.jdbc.driver.T4CConnection@5a1ed2dc is closed.
at org.apache.commons.dbcp.DelegatingConnection.checkOpen(DelegatingConnection.java:398)
at org.apache.commons.dbcp.DelegatingConnection.getTransactionIsolation(DelegatingConnection.java:353)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.getTransactionIsolation(PoolingDataSource.java:250)
at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCDatabaseTransaction$ManagedRegistryConnection.getTransactionIsolation(JDBCDatabaseTransaction.java:1479)
at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCTransactionManager.beginTransaction(JDBCTransactionManager.java:88)
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.beginTransaction(EmbeddedRegistry.java:443)
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.resourceExists(EmbeddedRegistry.java:631)
at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.resourceExists(CacheBackedRegistry.java:197)
at org.wso2.carbon.registry.core.session.UserRegistry.resourceExists(UserRegistry.java:623)
at org.wso2.carbon.mediation.registry.WSO2Registry.getResource(WSO2Registry.java:438)
at org.wso2.carbon.mediation.registry.WSO2Registry.getRegistryEntry(WSO2Registry.java:285)
at org.apache.synapse.registry.AbstractRegistry.getResource(AbstractRegistry.java:91)
at org.apache.synapse.config.SynapseConfiguration.getEntry(SynapseConfiguration.java:681)
at org.apache.synapse.config.SynapseConfiguration.getEndpoint(SynapseConfiguration.java:856)
at org.apache.synapse.endpoints.IndirectEndpoint.reLoadAndInitEndpoint(IndirectEndpoint.java:153)
at org.apache.synapse.endpoints.IndirectEndpoint.send(IndirectEndpoint.java:50)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:87)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:60)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:154)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:409)
at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:261)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

To overcome this you have to add the following validation query to Oracle RAC configuration in ESB registry.xml

<validationQuery>SELECT 1 FROM DUAL</validationQuery>

The above entry make sure that the connection is healthy before trying to access the DB. The above query is used when a Oralce DB is used. For other types of DB’s you need to add the relevant validation queries.

Advertisements

About kishanthan

I’m currently working as a Software Engineer at WSO2, an open source software company. I hold an Engineering degree, majoring in Computer Science & Engineering field, from University of Moratuwa, Sri Lanka.
This entry was posted in How to, WSO2 and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s