org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection

Database Administrators | jvos | 8 months ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to rafael . Or join the community to write better ones.
  1. 0

    Postgresql 9.5 + Windows 10 connection issues

    Database Administrators | 8 months ago | jvos
    org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection
  2. 0

    Postgres Connection Reset (Windows 10)

    Stack Overflow | 2 weeks ago | Marc Polizzi
    org.postgresql.util.PSQLException: The connection attempt failed.
  3. 0
    samebug tip
    It's possible you're trying to write to a connection that's already closed. Another cause for this is that you closed the socket with unread data in the socket receive buffer.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    samebug tip
    This might be caused by unmatching versions of SSL. Java starts normally with SSLv2 and your server might not be able to negotiate. You have to force Java to use SSLv3. See this comment: https://goo.gl/hx0YB3
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.net.SocketException

    Connection reset

    at java.net.SocketInputStream.read()
  2. Java RT
    SocketInputStream.read
    1. java.net.SocketInputStream.read(SocketInputStream.java:209)
    2. java.net.SocketInputStream.read(SocketInputStream.java:141)
    2 frames
  3. PostgreSQL JDBC Driver
    ConnectionFactory.openConnection
    1. org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:143)
    2. org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:112)
    3. org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:70)
    4. org.postgresql.core.PGStream.ReceiveChar(PGStream.java:283)
    5. org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:429)
    6. org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:223)
    7. org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
    7 frames
  4. org.postgresql.jdbc
    PgConnection.<init>
    1. org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:211)
    1 frame
  5. PostgreSQL JDBC Driver
    Driver.connect
    1. org.postgresql.Driver.makeConnection(Driver.java:407)
    2. org.postgresql.Driver.connect(Driver.java:275)
    2 frames
  6. Java RT
    DriverManager.getConnection
    1. java.sql.DriverManager.getConnection(DriverManager.java:664)
    2. java.sql.DriverManager.getConnection(DriverManager.java:208)
    2 frames
  7. Spring Framework
    AbstractDriverBasedDataSource.getConnection
    1. org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:153)
    2. org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:144)
    3. org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:155)
    4. org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:120)
    4 frames
  8. org.hibernate.engine
    DatasourceConnectionProviderImpl.getConnection
    1. org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
    1 frame
  9. Hibernate
    AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection
    1. org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:386)
    1 frame
  10. org.hibernate.resource
    LogicalConnectionManagedImpl.getPhysicalConnection
    1. org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:84)
    2. org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:109)
    2 frames
  11. Hibernate
    SessionImpl.connection
    1. org.hibernate.internal.SessionImpl.connection(SessionImpl.java:492)
    1 frame
  12. org.springframework.orm
    HibernateTransactionManager.doBegin
    1. org.springframework.orm.hibernate5.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:447)
    1 frame
  13. Spring Tx
    AbstractPlatformTransactionManager.getTransaction
    1. org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
    1 frame
  14. Spring TestContext
    SpringRepeat.evaluate
    1. org.springframework.test.context.transaction.TransactionContext.startTransaction(TransactionContext.java:98)
    2. org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethod(TransactionalTestExecutionListener.java:203)
    3. org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:269)
    4. org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
    5. org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
    6. org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
    6 frames
  15. JUnit
    ParentRunner.runLeaf
    1. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    1 frame
  16. Spring TestContext
    SpringJUnit4ClassRunner.runChild
    1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
    2. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
    2 frames
  17. JUnit
    ParentRunner$2.evaluate
    1. org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    2. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    3. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    4. org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    5. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    5 frames
  18. Spring TestContext
    RunAfterTestClassCallbacks.evaluate
    1. org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    2. org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    2 frames
  19. JUnit
    ParentRunner.run
    1. org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    1 frame
  20. Spring TestContext
    SpringJUnit4ClassRunner.run
    1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
    1 frame
  21. org.gradle.api
    SuiteTestClassProcessor.processTestClass
    1. org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114)
    2. org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57)
    3. org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66)
    4. org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
    4 frames
  22. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:497)
    4 frames
  23. org.gradle.internal
    ProxyDispatchAdapter$DispatchingInvocationHandler.invoke
    1. org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    2. org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    3. org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
    4. org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
    4 frames
  24. com.sun.proxy
    $Proxy2.processTestClass
    1. com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
    1 frame
  25. org.gradle.api
    TestWorker.processTestClass
    1. org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:109)
    1 frame
  26. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:497)
    4 frames
  27. org.gradle.internal
    MessageHub$Handler.run
    1. org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    2. org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    3. org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:377)
    3 frames
  28. Gradle Core
    StoppableExecutorImpl$1.run
    1. org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    2. org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
    2 frames
  29. Java RT
    Thread.run
    1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    3. java.lang.Thread.run(Thread.java:745)
    3 frames