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" />