Spring + Hibernate minor exception, SpringHibernate

Source: Internet
Author: User

Spring + Hibernate minor exception, SpringHibernate

Org. springframework. transaction. CannotCreateTransactionException: cocould 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. $ Proxy4.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)
... 33 more
Caused by: java. SQL. SQLException: Connections cocould not be 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)
... 38 more
Caused by: com. mchange. v2.resourcepool. CannotAcquireResourceException: A ResourcePool cocould 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)
... 41 more

 

Exception Description: An error occurred while establishing a connection to the database;

Cause:

I. Database Connection parameter configuration error:

1. There are spaces or line breaks in the parameter values: <property name = "user" value = "root"> </property>,

<Property name = "driverClass">
<Value> com. mysql. jdbc. Driver
</Value>
</Property>

2. Incorrect Parameter Values: Driver, url address, database name, and password are the databases to be connected

2. The database driver jar is not imported.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.