-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate+C3P0 with 2 DataSources failing in deadlock
PostPosted: Tue Apr 27, 2010 1:56 am 
Newbie

Joined: Tue Apr 27, 2010 1:52 am
Posts: 1
Hi,

I have a requirement for using two data sources.

They share the same jdbc URL but use different credentials for authentication.

Both of them have their own session factories and transaction managers defined and all DAO's are injected with the correct session factory in the XML config (not using autowired).

Application startup fails with:

WARN | ThreadPoolAsynchronousRunner.run:608 - com.mchange.v2.async.ThreadPoolAsynchronousRunner$ DeadlockDetector@1b317f5 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
WARN | ThreadPoolAsynchronousRunner.run:624 - com.mchange.v2.async.ThreadPoolAsynchronousRunner$ DeadlockDetector@1b317f5 -- APPARENT DEADLOCK!!! Complete Status:

Is this apparent deadlock as a result of having two data sources with the same jdbc URL?

Here is my config (removed some properties for simplicity), is there something wrong with it?

Code:
       
        <bean id="aDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
            <property name="jdbcUrl" value="${a.connection.url}"/>
            ....
       <property name="properties">
          <props>
            <prop key="user">${a.connection.username}</prop>
            <prop key="password">${a.connection.password}</prop>
          </props>
       </property>
   </bean>

   <bean id="aSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      <property name="dataSource" ref="aDataSource"/>
                ....
   </bean>
   
   <bean id="aTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="aSessionFactory" />
   </bean>

      <tx:annotation-driven transaction-manager="aTransactionManager" />
   


   <bean id="bDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
            <property name="jdbcUrl" value="${b.connection.url}"/>
            ....
       <property name="properties">
          <props>
            <prop key="user">${b.connection.username}</prop>
            <prop key="password">${b.connection.password}</prop>
          </props>
       </property>
   </bean>

   <bean id="bSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      <property name="dataSource" ref="bDataSource"/>
                ....
   </bean>
   
   <bean id="bTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="bSessionFactory" />
   </bean>

      <tx:annotation-driven transaction-manager="bTransactionManager" />


Top
 Profile  
 
 Post subject: Re: Hibernate+C3P0 with 2 DataSources failing in deadlock
PostPosted: Mon May 03, 2010 5:58 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Hi,
Quote:
Is this apparent deadlock as a result of having two data sources with the same jdbc URL?


In order to find an answer to this question, I suggest you first to analyze what the pending tasks are waiting on.
C3P0 is open source, so you can also download the source code relative to your C3P0 version.
You may also look in C3P0 user forum if you find something about.
http://old.nabble.com/c3p0---users-f28822.html
BTW: probably hibernate itself has nothing to do with the described problem, it is a problem between C3P0 and JDBC.


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

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.