java.sql.SQLException: Connections could not be acquired from the underlying database!

Atlassian JIRA | Jennifer Bennett [Atlassian] | 1 year ago
  1. 0

    It seems that there is a bug in the jTDS driver within Confluence, related to SSL connections to SQL Server, see here: http://sourceforge.net/p/jtds/bugs/725/ Similar bug report for JIRA: https://jira.atlassian.com/browse/JRA-39866 h3. Problem Confluence attempting to connect to SQL Server over SSL results in Network error IOException: Connection reset. If upgrading from a version of Confluence using Java 1.7, Confluence will not start up after the upgrade and the following appears in atlassian-confluence.log: {code}2015-11-24 16:14:38,738 WARN [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] [mchange.v2.resourcepool.BasicResourcePool] run com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6478f87d -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: java.sql.SQLException: Network error IOException: Connection reset at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:385) at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50) at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182) at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:209) at java.net.SocketInputStream.read(SocketInputStream.java:141) at net.sourceforge.jtds.ssl.TdsTlsInputStream.readFully(TdsTlsInputStream.java:131) at net.sourceforge.jtds.ssl.TdsTlsInputStream.primeBuffer(TdsTlsInputStream.java:100) at net.sourceforge.jtds.ssl.TdsTlsInputStream.read(TdsTlsInputStream.java:78) at sun.security.ssl.InputRecord.readFully(InputRecord.java:465) at sun.security.ssl.InputRecord.read(InputRecord.java:503) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) at net.sourceforge.jtds.ssl.SocketFactories$TdsTlsSocketFactory.createSocket(SocketFactories.java:102) at net.sourceforge.jtds.jdbc.SharedSocket.enableEncryption(SharedSocket.java:336) at net.sourceforge.jtds.jdbc.TdsCore.negotiateSSL(TdsCore.java:547) at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:338) ... 10 more 2015-11-24 16:14:38,743 WARN [localhost-startStop-1] [sf.hibernate.cfg.SettingsFactory] buildSettings Could not obtain connection metadata java.sql.SQLException: Connections could 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 net.sf.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35) at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84) at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1191) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:822) at org.springframework.orm.hibernate.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:540) at org.springframework.orm.hibernate.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:474) at{code} h3. Environment * Java 1.8 * SSL connection specified in db connection string: ";ssl=true" * Confluence is using jtds driver h3. Steps to Reproduce # Install Confluence 5.8.17 using the embedded JRE (1.8) # Use the default jtds driver installed with Confluence # Attempt to connect to a database with a secure connection - adding ;ssl=true to the database connection string. h3. Workaround * Switch the Java version used to 1.7 * Turn off SSL * Use Microsoft's JDBC drivers. * Use this patch: http://sourceforge.net/p/jtds/patches/129/ or http://sourceforge.net/p/jtds/bugs/_discuss/thread/16113049/7594/attachment/jtds-1.3.1.jar

    Atlassian JIRA | 1 year ago | Jennifer Bennett [Atlassian]
    java.sql.SQLException: Connections could not be acquired from the underlying database!
  2. 0

    It seems that there is a bug in the jTDS driver within Confluence, related to SSL connections to SQL Server, see here: http://sourceforge.net/p/jtds/bugs/725/ Similar bug report for JIRA: https://jira.atlassian.com/browse/JRA-39866 h3. Problem Confluence attempting to connect to SQL Server over SSL results in Network error IOException: Connection reset. If upgrading from a version of Confluence using Java 1.7, Confluence will not start up after the upgrade and the following appears in atlassian-confluence.log: {code}2015-11-24 16:14:38,738 WARN [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] [mchange.v2.resourcepool.BasicResourcePool] run com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6478f87d -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: java.sql.SQLException: Network error IOException: Connection reset at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:385) at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50) at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182) at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:209) at java.net.SocketInputStream.read(SocketInputStream.java:141) at net.sourceforge.jtds.ssl.TdsTlsInputStream.readFully(TdsTlsInputStream.java:131) at net.sourceforge.jtds.ssl.TdsTlsInputStream.primeBuffer(TdsTlsInputStream.java:100) at net.sourceforge.jtds.ssl.TdsTlsInputStream.read(TdsTlsInputStream.java:78) at sun.security.ssl.InputRecord.readFully(InputRecord.java:465) at sun.security.ssl.InputRecord.read(InputRecord.java:503) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) at net.sourceforge.jtds.ssl.SocketFactories$TdsTlsSocketFactory.createSocket(SocketFactories.java:102) at net.sourceforge.jtds.jdbc.SharedSocket.enableEncryption(SharedSocket.java:336) at net.sourceforge.jtds.jdbc.TdsCore.negotiateSSL(TdsCore.java:547) at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:338) ... 10 more 2015-11-24 16:14:38,743 WARN [localhost-startStop-1] [sf.hibernate.cfg.SettingsFactory] buildSettings Could not obtain connection metadata java.sql.SQLException: Connections could 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 net.sf.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35) at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84) at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1191) at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:822) at org.springframework.orm.hibernate.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:540) at org.springframework.orm.hibernate.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:474) at{code} h3. Environment * Java 1.8 * SSL connection specified in db connection string: ";ssl=true" * Confluence is using jtds driver h3. Steps to Reproduce # Install Confluence 5.8.17 using the embedded JRE (1.8) # Use the default jtds driver installed with Confluence # Attempt to connect to a database with a secure connection - adding ;ssl=true to the database connection string. h3. Workaround * Switch the Java version used to 1.7 * Turn off SSL * Use Microsoft's JDBC drivers. * Use this patch: http://sourceforge.net/p/jtds/patches/129/ or http://sourceforge.net/p/jtds/bugs/_discuss/thread/16113049/7594/attachment/jtds-1.3.1.jar

    Atlassian JIRA | 1 year ago | Jennifer Bennett [Atlassian]
    java.sql.SQLException: Connections could not be acquired from the underlying database!
  3. 0

    How to integrate spylog with tomcat 7 and hibernate?

    Stack Overflow | 3 years ago | Leejoy
    java.sql.SQLException: Connections could not be acquired from the underlying database!
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    c3p0 for 64bit tomcat

    Stack Overflow | 5 years ago | kkndbeef
    java.sql.SQLException: Connections could not be acquired from the underlying database!
  6. 0

    MySQL, c3p0 and Apache Felix integration

    Stack Overflow | 4 years ago | minhcong
    java.sql.SQLException: Connections could not be acquired from the underlying database!

  1. DoktorDoener666 2 times, last 1 month ago
  2. Aldin Kiselica 1 times, last 3 months ago
  3. mortalman7 6 times, last 5 months ago
  4. regisso 1 times, last 7 months ago
21 unregistered visitors
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.sql.SQLException

    Connections could not be acquired from the underlying database!

    at com.mchange.v2.sql.SqlUtils.toSQLException()
  2. c3p0:JDBC DataSources/Resource Pools
    AbstractPoolBackedDataSource.getConnection
    1. com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
    2. com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529)
    3. com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
    3 frames
  3. net.sf.hibernate
    Configuration.buildSessionFactory
    1. net.sf.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35)
    2. net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
    3. net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1191)
    4. net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:822)
    4 frames
  4. Hibernate
    LocalSessionFactoryBean.afterPropertiesSet
    1. org.springframework.orm.hibernate.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:540)
    2. org.springframework.orm.hibernate.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:474)
    2 frames