tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roy Leonardus <hyde.par...@gmail.com>
Subject BasicDataSource creation throws SQLException
Date Wed, 03 Aug 2016 08:46:25 GMT
Dear All,

I tried to create a new BasicDataSource and encountered such error

java.sql.SQLException: Cannot create PoolableConnectionFactory (isValid()
returned false)

this is caused by this method in the PoolableConnection

  public void  <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#>validate(String
<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/java/lang/String.java#String>
sql, int timeout) throws SQLException
<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/java/sql/SQLException.java#SQLException>
{

275 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#275>

<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#>

        if (_fastFailValidation
<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#PoolableConnection.0_fastFailValidation>
&& _fatalSqlExceptionThrown
<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#PoolableConnection.0_fatalSqlExceptionThrown>)
{

276 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#276>

<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#>

            throw new SQLException
<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/java/sql/SQLException.java#SQLException>(Utils.getMessage
<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/Utils.java#Utils.getMessage%28java.lang.String%29>("poolableConnection.validate.fastFail"));

277 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#277>

<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#>

        }

278 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#278>

<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#>

279 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#279>

<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#>

        if (sql == null || sql.length
<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/java/lang/String.java#String.length%28%29>()
== 0) {

280 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#280>

<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#>

            if (timeout < 0) {

281 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#281>

<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#>

                timeout = 0;

282 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#282>

<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#>

            }

283 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#283>

<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#>

            if (!isValid
<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/DelegatingConnection.java#DelegatingConnection.isValid%28int%29>(timeout))
{

284 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#284>

<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#>

                throw new SQLException
<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/java/sql/SQLException.java#SQLException>("isValid()
returned false");

285 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#285>

<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#>

            }

286 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#286>

<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#>

            return;

287 <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#287>

<http://grepcode.com/file/repo1.maven.org/maven2/org.apache.commons/commons-dbcp2/2.1/org/apache/commons/dbcp2/PoolableConnection.java#>

        }


problem here is : i have not set any timeout with the
setValidationQueryTimeout, but the error appears.


I also do not encounter such error in my tomcat 7 runtime.


Could you guys give some hints? the expectation is of course to
eliminate such error


Thank You beforehand.


Roy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message