日期:2014-05-16 浏览次数:20676 次
javax.servlet.ServletException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Connections could not be acquired from the underlying database!; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- for properties files --> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:c3p0.properties</value> </list> </property> </bean> <!-- for dataSource --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="${jdbc.driver}" /> <property name="jdbcUrl" value="${jdbc.url}" /> <property name="properties"> <props> <prop key="c3p0.minPoolSize">${hibernate.c3p0.minPoolSize}</prop> <prop key="hc3p0.maxPoolSize">${hibernate.c3p0.maxPoolSize}</prop> <prop key="hc3p0.timeout">${hibernate.c3p0.timeout}</prop> <prop key="c3p0.max_statement">${hibernate.c3p0.max_statement}</prop> <prop key="user">${jdbc.username}</prop> <prop key="password">${jdbc.password}</prop> <prop key="c3p0.testConnectionOnCheckout">true</prop> </props> </property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="mappingResources"> <list> <value>com/voff/hibernate/Blog.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect </prop> <prop key="hibernate.show_sql"> true </prop> <prop key="hibernate.connection.provider_class"> org.hibernate.connection.C3P0ConnectionProvider </prop> </props> </property> </bean> <!-- transactionManager --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <bean id="BlogDao" class="com.voff.dao.BlogDaoimpl"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <!-- spring dao proxy --> <bean id="BlogDaoProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"> <ref bean="transactionManager"/> </property>