Hi
We have a web application which is making use of Hibernate for acessing DB (Oracle 11g). What currently happening is, whenever our DB goes down(or crashes) due to some reason and we bring it up , then if the client refreshes the application(once its up) he gets the error message like below:
faultCodeServer.Processing faultString:'com.apd.config.ConfigurationFault : ' faultDetail:'null' Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: JDBC rollback failed Io exception: Software caused connection abort: socket write error
What we want is, once the DB is up again, client should not get any error and application should work normally thereafter. To achieve this we decided to use C3PO library along with Hibernate to manage the connection pool. Unfortunately that also did not solve our problem still. We use Tomact server for application deployment.
Below is snapshot of the hibernate config file containing the hibernate and C3PO properties.
<property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${db.dialect}</prop> <prop key="hibernate.cache.use_query_cache">${connectionPool.useQueryLevelCache}</prop> <prop key="hibernate.cache.use_second_level_cache">${connectionPool.useSecondLevelCache}</prop> <prop key="hibernate.cache.provider_class">${connectionPool.cacheProvider}</prop>
<prop key="hibernate.connection.autoReconnect">${connectionPool.autoReconnect}</prop> <prop key="hibernate.connection.provider_class">${connectionPool.connectionProvider}</prop> <prop key="hibernate.c3p0.min_size">${connectionPool.minIdle}</prop> <prop key="hibernate.c3p0.max_size">${connectionPool.maxActive}</prop> <prop key="hibernate.c3p0.acquire_increment">5</prop> <prop key="hibernate.c3p0.max_statements">${connectionPool.maxStatements}</prop> <prop key="hibernate.c3p0.idle_test_period">${connectionPool.idleTestPeriod}</prop> <prop key="hibernate.c3p0.validate ">${connectionPool.testConnectionOnCheckout}</prop> <prop key="hibernate.c3p0.preferredTestQuery">${connectionPool.preferredQuery}</prop> <prop key="hibernate.c3p0.testConnectionOnCheckin">${connectionPool.testConnectionOnCheckin}</prop> <prop key="hibernate.c3p0.autoCommitOnClose">${connectionPool.testConnectionOnCheckin}</prop> </props> </property>
Here is the snapshot of the properties file for the values
db.dialect=org.hibernate.dialect.Oracle10gDialect connectionPool.minIdle=5 connectionPool.maxActive=20 connectionPool.inactivityTimeOut=300 connectionPool.idleTestPeriod=300 connectionPool.abandonedConnectionTimeout=30 connectionPool.maxStatements=30 connectionPool.validateConnection=true connectionPool.connectionWaitTimeOut=10 connectionPool.connectionCachingEnabled=true connectionPool.fastConnectionFailoverEnabled=true connectionPool.connectionCacheName=ciCache connectionPool.useQueryLevelCache=true connectionPool.useSecondLevelCache=true connectionPool.cacheProvider=net.sf.ehcache.hibernate.EhCacheProvider connectionPool.connectionProvider=org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider connectionPool.autocommit=false connectionPool.preferredQuery=select 1 from dual connectionPool.autoReconnect=true connectionPool.testConnectionOnCheckout =true connectionPool.testConnectionOnCheckin =true
Please can someone tell what we are doing wrong here.
|