Quote:
"jsp_servlet._web_45_inf._views._jsp.__error.org.springframework.transaction.IllegalTransactionStateException: Pre-bound JDBC Connection found! HibernateTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource itself. It is recommended to use a single HibernateTransactionManager for all transactions on a single DataSource, no matter whether Hibernate or JDBC access."
I have been getting this exception from quite long now and I am pissed off from this exception now.
My application was working perfectly till last month but suddenly it started throwing this exception very often now.
I feel like it throws this exception everytime application talks to DB.
my hibernate config file is
Quote:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="preprod4tst14jndi"/>
</bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>/WEB-INF/jdbc.properties</value>
<value>/WEB-INF/application.properties</value>
</list>
</property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<value>obopaycrm.hbm.xml</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.connection.autoReconnect">true</prop>
<prop key="hibernate.connection.autoReconnectForPools">true</prop>
<prop key="hibernate.connection.is-connection-validation-required">true</prop>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.transaction.manager_lookup_class">
org.hibernate.transaction.WeblogicTransactionManagerLookup
</prop>
<prop key="hibernate.use_identifer_rollback">true</prop>
<prop key="hibernate.connection.autocommit">true</prop>
<prop key="hibernate.connection.release_mode">after_statement</prop>
<prop key="hibernate.transaction.auto_close_session">true</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
<!-- <property name="entityInterceptor" ref="auditLogInterceptor" /> -->
<property name="entityInterceptorBeanName">
<value>auditLogInterceptor</value>
</property>
</bean>
<bean id="transactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager"/>
<property name="target" ref="genericDAO"/>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_SUPPORTS,readOnly</prop>
<prop key="find*">PROPAGATION_SUPPORTS,readOnly</prop>
<prop key="load*">PROPAGATION_SUPPORTS,readOnly</prop>
<prop key="save*">PROPAGATION_SUPPORTS</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
<prop key="merge*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<bean name="obopaycrm:type=HibernateStatistics" class="org.hibernate.jmx.StatisticsService">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="auditSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<value>obopaycrm.hbm.xml</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.transaction.manager_lookup_class">
org.hibernate.transaction.WeblogicTransactionManagerLookup
</prop>
<prop key="hibernate.use_identifer_rollback">true</prop>
<prop key="hibernate.transaction.auto_close_session">true</prop>
</props>
</property>
</bean>
<bean id="auditLogInterceptor" class="com.aztecsoft.obopay.crm.common.AuditLogInterceptor" scope="prototype">
<property name="sessionFactory" ref="auditSessionFactory"></property>
<property name="messageSource" ref="messageSource"/>
</bean>
</beans>
there's another interceptor being used in it, that is for auditing. it helps capturing any kind of insert/update done in database.
I had a strong feeling that there is definitely something wrong here in this file.
the way I am doing a save in db is like
Quote:
public void saveObject(final Object o) {
HibernateCallback action = new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
try{
if(o != null)
{
session.saveOrUpdate(o);
}
}
catch (Exception e) {
logger.error("Exception in GenericDAOHibernate--- saveObject()"+e);
}
return null;
}
};
getHibernateTemplate().execute(action);
}
My jdbc.properties file is
Quote:
hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
Quote:
I am using spring 2.0.6
hibernate 3.2.3.ga
database is oracle 10g
and server is bea weblogic 8i
database driver used is Oracle's Driver (Thin)Versions 9.0.1,9.0.2,10
Someone please help me come out of this problem at the earliest possible.