Не удалось открыть Hibernate Session для транзакции - PullRequest
0 голосов
/ 22 января 2011

Я получаю эту ошибку.Пожалуйста, помогите мне.

org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
 org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)
 org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
 org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
 org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
 $Proxy20.findFlierByID(Unknown Source)
 servlets.AwardServlet.doGet(AwardServlet.java:34)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause

org.hibernate.exception.GenericJDBCException: Cannot open connection
 org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
 org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
 org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
 org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
 org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
 org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
 org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
 org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
 org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1354)
 org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
 org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
 org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
 org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
 $Proxy20.findFlierByID(Unknown Source)
 servlets.AwardServlet.doGet(AwardServlet.java:34)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
 org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
 org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
 org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
 org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82)
 org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
 org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
 org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
 org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
 org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1354)
 org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
 org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
 org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
 org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
 $Proxy20.findFlierByID(Unknown Source)
 servlets.AwardServlet.doGet(AwardServlet.java:34)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause

java.lang.NullPointerException
 sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(Unknown Source)
 sun.jdbc.odbc.JdbcOdbcDriver.knownURL(Unknown Source)
 sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(Unknown Source)
 java.sql.DriverManager.getDriver(Unknown Source)
 org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
 org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
 org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
 org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82)
 org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
 org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
 org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
 org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
 org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1354)
 org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)
 org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374)
 org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
 org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
 $Proxy20.findFlierByID(Unknown Source)
 servlets.AwardServlet.doGet(AwardServlet.java:34)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Я видел много примеров в сети, но я не мог решить эту проблему.поэтому, пожалуйста, помогите мне.

1 Ответ

0 голосов
/ 23 января 2013

Я недавно столкнулся с этой проблемой.Я обнаружил, что из-за потери соединения с базой данных из приложения появляется эта ошибка.Возможно, вы выполняете какую-то операцию, когда БД находится в автономном режиме.

Проверьте параметры, связанные с подключением.

Надеюсь, это поможет.

...