我在hibernate和my sql中使用spring。我有个例外

at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:68)
 at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1290)
 at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
 at $Proxy3.beginTransaction(Unknown Source)
 at com.iris.allofactor.data.dao.hibernate.HibernatePatientDao.getAllPatient(HibernatePatientDao.java:1419)
 at com.iris.allofactor.data.dao.impl.PatientBODaoImpl.getAllPatient(PatientBODaoImpl.java:256)
 at com.iris.allofactor.data.dao.facade.DaoFacadeImpl.getAllPatient(DaoFacadeImpl.java:2758)
 at sun.reflect.GeneratedMethodAccessor1125.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
 at $Proxy2.getAllPatient(Unknown Source)
 at com.iris.allofactor.services.impl.AutoSyncServiceImpl.getAllPatient(AutoSyncServiceImpl.java:1561)
 at com.iris.allofactor.services.soap.impl.AutoSyncWebServiceImpl.getAllPatient(AutoSyncWebServiceImpl.java:441)
 at sun.reflect.GeneratedMethodAccessor1124.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
 at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
 at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
 at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
 at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
 at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
 at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
 at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
 at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
 at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
 at java.lang.Thread.run(Thread.java:619)

这是我的c3p00l配置
 <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
  <!--  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
     <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" >  -->
        <property name="driverClass"><value>${jdbc.driverClassName}</value></property>
        <property name="jdbcUrl"><value>${jdbc.url}</value></property>
        <property name="user"><value>${jdbc.username}</value></property>
        <property name="password"><value>${jdbc.password}</value></property>
    </bean>

我如何解决这个问题,这个问题是否与c3pool相关。我使用的是带有默认值的c3pool,是否需要指定任何c3pool属性

最佳答案

Did you try this one?

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
    <property name="driverClass"><value>${jdbc.driverClassName}</value></property>
    <property name="jdbcUrl"><value>${jdbc.url}</value></property>
    <property name="user"><value>${jdbc.username}</value></property>
    <property name="password"><value>${jdbc.password}</value></property>
    <property name="validationQuery" value="SELECT 1"/>
    <property name="testOnBorrow" value="true"/>
</bean>

10-05 17:53