Org.springframework.transaction.CannotCreateTransactionException:Could not open Hibernate Session for transaction; Nested exception is org.hibernate.exception.GenericJDBCException:Cannot open connection
At Org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin (hibernatetransactionmanager.java:596)
At Org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction ( abstractplatformtransactionmanager.java:371)
At Org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary ( transactionaspectsupport.java:335)
At Org.springframework.transaction.interceptor.TransactionInterceptor.invoke (transactioninterceptor.java:105)
At Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (reflectivemethodinvocation.java:172)
At Org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke (exposeinvocationinterceptor.java:90)
At Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (reflectivemethodinvocation.java:172)
At Org.springframework.aop.framework.JdkDynamicAopProxy.invoke (jdkdynamicaopproxy.java:202)
At Com.sun.proxy. $Proxy 4.save (Unknown Source)
At Test.dao.FundInfoDaoImplTest.testSave (fundinfodaoimpltest.java:31)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)
At Java.lang.reflect.Method.invoke (method.java:606)
At Org.junit.runners.model.frameworkmethod$1.runreflectivecall (frameworkmethod.java:44)
At Org.junit.internal.runners.model.ReflectiveCallable.run (reflectivecallable.java:15)
At org.junit.runners.model.FrameworkMethod.invokeExplosively (frameworkmethod.java:41)
At Org.junit.internal.runners.statements.InvokeMethod.evaluate (invokemethod.java:20)
At Org.junit.internal.runners.statements.RunBefores.evaluate (runbefores.java:28)
At Org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored (blockjunit4classrunner.java:79)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:71)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:49)
At Org.junit.runners.parentrunner$3.run (parentrunner.java:193)
At Org.junit.runners.parentrunner$1.schedule (parentrunner.java:52)
At Org.junit.runners.ParentRunner.runChildren (parentrunner.java:191)
At org.junit.runners.parentrunner.access$000 (parentrunner.java:42)
At Org.junit.runners.parentrunner$2.evaluate (parentrunner.java:184)
At Org.junit.runners.ParentRunner.run (parentrunner.java:236)
At Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (junit4testreference.java:50)
At Org.eclipse.jdt.internal.junit.runner.TestExecution.run (testexecution.java:38)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:467)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:683)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (remotetestrunner.java:390)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (remotetestrunner.java:197)
caused By:org.hibernate.exception.GenericJDBCException:Cannot Open connection
At Org.hibernate.exception.SQLStateConverter.handledNonSpecificException (sqlstateconverter.java:126)
At Org.hibernate.exception.SQLStateConverter.convert (sqlstateconverter.java:114)
At Org.hibernate.exception.JDBCExceptionHelper.convert (jdbcexceptionhelper.java:66)
At Org.hibernate.exception.JDBCExceptionHelper.convert (jdbcexceptionhelper.java:52)
At Org.hibernate.jdbc.ConnectionManager.openConnection (connectionmanager.java:449)
At Org.hibernate.jdbc.ConnectionManager.getConnection (connectionmanager.java:167)
At Org.hibernate.jdbc.JDBCContext.connection (jdbccontext.java:142)
At Org.hibernate.transaction.JDBCTransaction.begin (jdbctransaction.java:85)
At Org.hibernate.impl.SessionImpl.beginTransaction (sessionimpl.java:1354)
At Org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin (hibernatetransactionmanager.java:555)
... More
caused By:java.sql.SQLException:Connections could not being acquired from the underlying database!
At Com.mchange.v2.sql.SqlUtils.toSQLException (sqlutils.java:106)
At Com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection (c3p0pooledconnectionpool.java:529 )
At Com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection (abstractpoolbackeddatasource.java:128)
At Org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection ( LOCALDATASOURCECONNECTIONPROVIDER.JAVA:81)
At Org.hibernate.jdbc.ConnectionManager.openConnection (connectionmanager.java:446)
... More
Caused by:com.mchange.v2.resourcepool.CannotAcquireResourceException:a resourcepool could not acquire A resource from its primary factory or source.
At Com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable (basicresourcepool.java:1319)
At Com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource (basicresourcepool.java:557)
At Com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource (basicresourcepool.java:477)
At Com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection (c3p0pooledconnectionpool.java:525 )
... More
Exception Description: Failed to establish connection with database;
Reason:
One, the database connection parameter configuration error:
1, the parameter value has a space or newline: <property name= "user" value="root"></property>
<property name="Driverclass" >
<value>com.mysql.jdbc.driver
</value>
</property>
2, the parameter value is incorrect: driver, URL address, database name and password is the database to connect to
Second, the database driver jar was not imported.
Spring+hibernate Minor anomalies