Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat connection pooling, maxActive and maxWait properties

I have a Java service running in Tomcat that uses Tomcat's DataSource and PoolProperties from org.apache.tomcat.jdbc.pool as in the "Plain Ol' Java" example.

In the stage environment that has Tomcat 8.0.29 I noticed the following 2 lines in the Catalina log.

WARNING [localhost-startStop-1] org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory.getObjectInstance Name = somedb Property maxActive is not used in DBCP2, use maxTotal instead. maxTotal default value is 8. You have set value of "50" for "maxActive" property, which is being ignored.
WARNING [localhost-startStop-1] org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory.getObjectInstance Name = somedb Property maxWait is not used in DBCP2 , use maxWaitMillis instead. maxWaitMillis default value is -1. You have set value of "10000" for "maxWait" property, which is being ignored.

I don't see such log entries in the dev environment that has Tomcat 8.0.21.

I cannot set up the datasource as a JNDI resource and I don't see any setters corresponding to maxTotal and maxWaitMillis in PoolProperties.

How can I set those values so that they are not ignored?

like image 835
Ivan Gerken Avatar asked Dec 17 '15 12:12

Ivan Gerken


1 Answers

Tomcat JDBC Connection Pool and Apache DBCP are two different connection pool implementations.

In your stage environment you probably have Apache DBCP2 in classpath and Tomcat tries to use it instead of Tomcat JDBC Connection Pool.

like image 133
Michał Maciej Gałuszka Avatar answered Nov 26 '22 07:11

Michał Maciej Gałuszka