-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Pre-bound JDBC Connection found! HibernateTransactionManager
PostPosted: Mon Mar 02, 2009 1:34 am 
Newbie

Joined: Mon Dec 08, 2008 9:03 am
Posts: 5
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.