Tomcat's connection pool opens only 20 connections to mysql
- by stck
I have a java application with following line in context.xml
<Resource 
    driverClassName="com.mysql.jdbc.Driver" 
    maxActive="100" 
    maxIdle="30" 
    initialSize="10" 
    maxWait="7000" 
    name="jdbc/app" 
    password="pass" 
    type="javax.sql.DataSource" 
    url="jdbc:mysql://dbhost:3306/dbname?autoReconnect=true" 
    username="user" 
    validationQuery="SELECT 1" 
    removeAbandoned="true" 
    removeAbandonedTimeout="30" 
    logAbandoned="true" 
/>
In mysql 'show variables' tells me that max_connections is 151.
Still,
use information_schema;
select count(*) from processlist where User = 'user';
never shows me more than 20 connections. On tomcat's catalina.out -log I get
Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool exhausted
        at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:103)
        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
        at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:113)
        at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)
What should I check for to find the problem?