You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Swapnil.Kale" <sw...@gmail.com> on 2007/10/29 21:09:50 UTC

Re: org.apache.commons.dbcp.DbcpException: java.sql.SQLException

Hi,
I couldnt get a better place to post my question.

I'm getting org.apache.commons.dbcp.DbcpException: java.sql.SQLException
Cannot get a connection, Connection pool exhausted. 
I'm using spring with Tomcat 6 to manage the Connection pooling. My
application is a 3 tier application (Swing + Tomcat 6/Spring/RMI + Database
Oracle 10g)
The database has multiple schemas running and the no. of processes are set
to 300.

Here is the entry for the spring-servlet.

      <property name="maxActive">
            <value>3000</value>
        </property>

        <property name="maxWait">
            <value>10000</value> <!-- Wait for a connection from the pool
for 10 sec, then time out -->
        </property>
    </bean>

I dont have any other entry related to timeout/removeabondoned etc.

I've to restart the server frequently due to this exception (The frequency
is once in every two days).

Am i missing any importnt property?  I'm not able to figure out where to
check the closing connections (A lot of Google threads talk about close
connections as a major reason behind the failure.)

Is there any relation in no. of processes (300) set on oracle and the
maxActive (3000) in servlet xml?

Can anybody throw some light on this issue?








ajay kumar wrote:
> 
> Hi Everybody,
> 
>               This is Ajay Kumar.I implemented DBCP through tomcat
> container.Some times when i run the webpages it is giving the
> following Exception:
> 
> org.apache.commons.dbcp.DbcpException: java.sql.SQLException: Server
> connection failure during transaction. Attempted reconnect 3 times.
> Giving up
> 
>               I think it is the problem with the values which are
> mentioned in the server.xml for DBCP.Here are the details of
> server.xml
> 
> <parameter>
>    <name>maxActive</name>
>    <value>100</value>
> </parameter>
> <parameter>
>    <name>maxIdle</name>
>    <value>20</value>
> </parameter>
> <parameter>
>   <name>maxWait</name>
>   <value>10000</value>
> </parameter>
> <parameter>
>    <name>removeAbandoned</name>
>    <value>true</value>
> </parameter>
> <parameter>
>    <name>removeAbandonedTimeout</name>
>    <value>300</value>
> </parameter>
> <parameter>
>     <name>logAbandoned</name>
>     <value>true</value>
> </parameter>
> 
>                  If any body know the solution please mail me the
> details.Thanks in advance...
>        
> -- Ajay
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/org.apache.commons.dbcp.DbcpException%3A-java.sql.SQLException-tf69524.html#a13475886
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: org.apache.commons.dbcp.DbcpException: java.sql.SQLException

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Swapnil,

Swapnil.Kale wrote:
> I'm getting org.apache.commons.dbcp.DbcpException: java.sql.SQLException
> Cannot get a connection, Connection pool exhausted. 

Sounds like you are running out of database connections.

> The database has multiple schemas running and the no. of processes are set
> to 300.

What do you mean, "no. of processes"?

> Here is the entry for the spring-servlet.
> 
>       <property name="maxActive">
>             <value>3000</value>
>         </property>

That's 3000, not 300. And it's a lot, if you ask me. How many
simultaneous HTTP connections do you support? It's foolish to have the
number of pooled connections exceed the number of HTTP connections you
are willing to accept: those extra connections are just taking up memory
and network resources.

> I don't have any other entry related to timeout/removeabondoned etc.

Given that you are running out of connections, I would recommend enabling:

removeAbandoned
removeAbaondonedTimeout
logAbandoned

> I've to restart the server frequently due to this exception (The frequency
> is once in every two days).
> 
> Am i missing any important property?  I'm not able to figure out where to
> check the closing connections (A lot of Google threads talk about close
> connections as a major reason behind the failure.)

See above. Yes, the problem is usually sloppy resource management (or
none at all) in your application's code.

> Is there any relation in no. of processes (300) set on oracle and the
> maxActive (3000) in servlet xml?

Well, Oracle will probably veto 90% of the connections you try to make
to it if you actually start using all 3000 of those connections.

> Can anybody throw some light on this issue?

Enable the debugging settings listed above and run your server normally.
You should be able to see where connections are getting list (you'll get
a full stack trace dumped for where a connection was requested from the
pool, if, after "removeAbandonedTimeout" seconds, the connection is not
returned to the pool. That will tell you where the connection was
requested. Then, follow the code starting there to see what might have
gone wrong.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHJkFl9CaO5/Lv0PARAsihAJ9WdoULOjgcfl+b2SVmls46V3uDJACgjA4J
xR9rAIfMFITeutPIQaFLVdw=
=UIpr
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org