Subject Re: Java: Cannot get a connection, pool exhausted
Author Luke Young
Thanks Roman,

I am using my web.xml file to configure the driver and using the
settings mentioned:

I am using this driver:

org.firebirdsql.jdbc.FBDriver

And this Database URL:

jdbc:firebirdsql:localhost/3050:C:\\Subfolder\\Subfolder\\THEDB.FDB

I believe this to be correct and I also believe that the server is
running.

The following code is used to make the connection:

DatabaseConfig databaseConfig = new DatabaseConfig();
databaseConfig.setDriver( getInitParameter( "Driver" ) );
databaseConfig.setDatabaseURL( getInitParameter( "DatabaseURL" ) );
databaseConfig.setUsername( getInitParameter( "Username" ) );
databaseConfig.setPassword( getInitParameter( "Password" ) );
databaseConfig.setInitialconnections( convertToInt(
getInitParameter( "Initialconnections" ) ) );
databaseConfig.setMaxconnections( convertToInt(
getInitParameter( "Maxconnections" ) ) );

dataSource = getDataSource( databaseConfig );


And the last line is producing a dataSource object (well it is not null).

But when I call the getConnection() I get the following errors:

org.apache.commons.dbcp.SQLNestedException: Cannot get a connection,
pool exhausted, cause:
java.util.NoSuchElementException: Could not create a validated object
at
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:851)
at
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:140)
at
com.blade.tools.datasource.Blade2DataManager.currentProject(Blade2DataManager.java:41)
at
com.blade.tools.task.Blade2Controller.initialiseForm(Blade2Controller.java:82)
at
com.blade.tools.task.Blade2Controller.doPostGet(Blade2Controller.java:54)
at com.blade.tools.task.Blade2Controller.doGet(Blade2Controller.java:36)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)


--- In Firebird-Java@yahoogroups.com, Roman Rokytskyy <rrokytskyy@...>
wrote:
>
> Hi,
>
> > I am trying to connect to my Firebird database from Java, but I get
> > the following error message:
> >
> > org.apache.commons.dbcp.SQLNestedException: Cannot get a connection,
> > pool exhausted, cause:
> > java.util.NoSuchElementException: Could not create a validated object
> > at
> >
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.ja\
> > va:851)
> > at
> >
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:1\
> > 40)
> >
> > I am using this driver: org.firebirdsql.jdbc.FBDriver
> >
> > And this Database URL:
> > jdbc:firebirdsql:localhost/3050:C:\\Subfolder\\Subfolder\\THEDB.FDB
>
> I do not know the DBCP behavior in details, so check the following:
>
> - database server is started
> - jdbc driver is in the classpath
> - database path is correct
>
> In theory there must be bigger stack trace including org.firebirdsql.*
> classes, it will contain much more useful information.
>
> Alternatively, post the DBCP configuration/Java code you use to access
> the database.
>
> Roman
>