Hibernate中断异常

时间:2014-08-19 22:41:13

标签: java spring hibernate

有没有人知道这是什么类型的错误?环顾网络有很多信息。

数据源初始

@Bean
    public DataSource dataSource() {
        ComboPooledDataSource cpds = new ComboPooledDataSource();
        try {
            cpds.setDriverClass(Driver.class.getName());
        }
        catch (PropertyVetoException e) {
            throw new RuntimeException(e);
        } // loads the jdbc driver
        cpds.setJdbcUrl(jdbcUrl());
        cpds.setUser(user);
        cpds.setPassword(password);
        cpds.setPreferredTestQuery("SELECT 1");
        cpds.setTestConnectionOnCheckout(true);

        // Optional - If you want to turn on PreparedStatement pooling, you must also set maxStatements and/or
        // maxStatementsPerConnection (both default to 0):
        cpds.setMaxStatements(100);
        return cpds;
    }

栈跟踪

  22:11:54.502 [Scheduler-1] ERROR o.h.e.jdbc.spi.SqlExceptionHelper - An SQLException was provoked by the following failure: java.lang.InterruptedException
22:11:54.524 [Scheduler-1] ERROR c.p.scheduler.TenantTransform - An error occurred in the ETL worker.
org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [n/a]; SQL state [null]; error code [0]; An SQLException was provoked by the following failure: java.lang.InterruptedException; nested exception is org.hibernate.exception.GenericJDBCException: An SQLException was provoked by the following failure: java.lang.InterruptedException
  at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:651) ~[spring-orm-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:106) ~[spring-orm-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:403) ~[spring-orm-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:58) ~[spring-tx-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213) ~[spring-tx-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:163) ~[spring-tx-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.data.jpa.repository.support.LockModeRepositoryPostProcessor$LockModePopulatingMethodIntercceptor.invoke(LockModeRepositoryPostProcessor.java:92) ~[spring-data-jpa-1.3.2.RELEASE.jar:na]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at com.sun.proxy.$Proxy65.findPendingCourseRegistrationInSisIdsAndTenantId(Unknown Source) ~[na:na]
  at com.processPendingEnrollments(PifToOpenClassTransformer.java:93) ~[PifToOpenClassTransformer.class:na]
  at com.Transformer.java:73) ~[PifToOpenClassTransformer.class:na]
  at com.process(TenantTransform.java:121) ~[TenantTransform.class:na]
  at com.TenantTask.run(TenantTask.java:21) [TenantTask.class:na]
  at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_55]
  at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_55]
  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_55]
  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [na:1.7.0_55]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_55]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_55]
  at java.lang.Thread.run(Thread.java:745) [na:1.7.0_55]
Caused by: org.hibernate.exception.GenericJDBCException: An SQLException was provoked by the following failure: java.lang.InterruptedException
  at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.continueInvocation(ConnectionProxyHandler.java:146) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at com.sun.proxy.$Proxy72.prepareStatement(Unknown Source) ~[na:na]
  at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:147) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:166) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:145) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1854) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1831) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1811) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.loader.Loader.doQuery(Loader.java:899) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.loader.Loader.doList(Loader.java:2516) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.loader.Loader.doList(Loader.java:2502) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2332) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.loader.Loader.list(Loader.java:2327) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:490) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:195) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1247) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:264) ~[hibernate-entitymanager-4.1.12.Final.jar:4.1.12.Final]
  at sun.reflect.GeneratedMethodAccessor240.invoke(Unknown Source) ~[na:na]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_55]
  at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_55]
  at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:311) ~[spring-orm-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at com.sun.proxy.$Proxy63.getResultList(Unknown Source) ~[na:na]
  at org.springframework.data.jpa.repository.query.JpaQueryExecution$CollectionExecution.doExecute(JpaQueryExecution.java:77) ~[spring-data-jpa-1.3.2.RELEASE.jar:na]
  at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:55) ~[spring-data-jpa-1.3.2.RELEASE.jar:na]
  at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:95) ~[spring-data-jpa-1.3.2.RELEASE.jar:na]
  at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:85) ~[spring-data-jpa-1.3.2.RELEASE.jar:na]
  at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:312) ~[spring-data-commons-1.5.1.RELEASE.jar:na]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) ~[spring-tx-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) ~[spring-tx-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) ~[spring-tx-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155) ~[spring-tx-3.2.4.RELEASE.jar:3.2.4.RELEASE]
  ... 20 common frames omitted
Caused by: java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.InterruptedException
  at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118) ~[mchange-commons-java-0.2.3.4.jar:na]
  at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:77) ~[mchange-commons-java-0.2.3.4.jar:na]
  at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:74) ~[mchange-commons-java-0.2.3.4.jar:na]
  at com.mchange.v2.c3p0.stmt.GooGooStatementCache.acquireStatement(GooGooStatementCache.java:583) ~[c3p0-0.9.2.1.jar:0.9.2.1]
  at com.mchange.v2.c3p0.stmt.GooGooStatementCache.checkoutStatement(GooGooStatementCache.java:204) ~[c3p0-0.9.2.1.jar:0.9.2.1]
  at com.mchange.v2.c3p0.impl.NewPooledConnection.checkoutStatement(NewPooledConnection.java:308) ~[c3p0-0.9.2.1.jar:0.9.2.1]
  at com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:148) ~[c3p0-0.9.2.1.jar:0.9.2.1]
  at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source) ~[na:na]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_55]
  at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_55]
  at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.continueInvocation(ConnectionProxyHandler.java:138) ~[hibernate-core-4.1.12.Final.jar:4.1.12.Final]
  ... 56 common frames omitted
Caused by: java.lang.InterruptedException: null
  at java.lang.Object.wait(Native Method) ~[na:1.7.0_55]
  at java.lang.Object.wait(Object.java:503) ~[na:1.7.0_55]
  at com.mchange.v2.c3p0.stmt.GooGooStatementCache.acquireStatement(GooGooStatementCache.java:573) ~[c3p0-0.9.2.1.jar:0.9.2.1]
  ... 63 common frames omitted

1 个答案:

答案 0 :(得分:1)

也许这个链接可以提供帮助:

hibernate.atlassian.net/browse/HHH-6891

它说: “Peter Salhofer添加了评论 - 30 / Jul / 2012 05:49 AM 与Spring 3.1,Webflow 3.1和Hibernate 4.1.4完全相同的问题。尝试过公共dbcp和c3p0。连接池始终没有连接。 我的解决方案:我改为tomcat-jdbc(org.apache.tomcat.jdbc.pool.DataSource),现在一切正常!“

还有一些主题可以帮助您解决一些问题: An SQLException was provoked, java.lang.InterruptedException, am I running out of db connections?