I am having a problem with hibernate and c3p0 in Tomcat environments.
I have two fairly similar deployment environments, TEST and PROD. TEST uses Tomcat6.0/MySql6.1; PROD uses Tomcat5.5/MySql5.0. I use c3p0-0.9.1.2.jar and the following in my hibernate.cfg.xml file:
Code:
<property name="c3p0.min_size">5</property>
<property name="c3p0.max_size">20</property>
<property name="c3p0.timeout">1800</property>
<property name="c3p0.max_statements">50</property>
<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
I am also using Spring, and my dao.xml has the following:
Code:
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory"><ref local="mySessionFactory"/></property>
</bean>
<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
<property name="exposeTransactionAwareSessionFactory" value="true"/>
Everything runs fine on TEST, but I can't get PROD to start, the Tomcat log has the following:
Code:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in ServletContext resource [/WEB-INF/lifeplan-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in class path resource [lifeplan-dao.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Could not instantiate C3P0 connection pool
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
java.security.AccessController.doPrivileged(Native Method)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170)
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:883)
org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:584)
I can't figure this out, any ideas on a solution or things I could try?
Thanks,
--Bob