recurrence of problems
Project on the history of the project to address vulnerability scanning from Tomcat 6.0 upgraded to version 9.0, the service startup logs show the following warnings, the data source is configured through the JNDI method in the console wildly brush can not find the tablespace error (no screenshot)
Report an error:
06-Nov-2024 10:32:03.701 warnings [main] Name = data sources Property maxActive is not used in DBCP2, use maxTotal instead. maxTotal default value is 8. You have set value of "1000" for "maxActive" property, which is being ignored.
06-Nov-2024 10:32:03.708 warnings [main] Name = data sources Property maxWait is not used in DBCP2 , use maxWaitMillis instead. maxWaitMillis default value is PT-0.001S. You have set value of "10000" for "maxWait" property, which is being ignored.
The JNDI datasource configuration is illustrated in the following diagram.
<Context path="/test" docBase="test" debug="1" reloadable="true" crossContext="true">
<Resource auth="Container" name="jdbc/test" type="" driverClassName=""
maxActive="1000" maxIdle="300" maxWait="10000"
url="jdbc:oracle:thin:@10.2.99.99:1521/CLCDB" username="test" password="test" />
</Context>
Causes of problems
Looking through the migration documentation on the official website, I found that Tomcat 8 started to modify the default built-in datasource version, upgrading it from DBCP1 to DBCP2. The DBCP1 implementation was copied to the factory, DBCP2 uses the new implementation of common-dbcp.
- /
- /tomcat-8.0-doc/#JNDI_Factory_and_Type
cure
Solving the data source problem requires a decision from the factory where the connection is defined as to which DBCP connection pool version to use.
Add the factory=""
to specify the connection pool.
<Context path="/test" docBase="test" debug="1" reloadable="true" crossContext="true">
<Resource auth="Container" name="jdbc/test" factory=""
type="" driverClassName=""
maxActive="1000" maxIdle="300" maxWait="10000"
url="jdbc:oracle:thin:@10.2.99.99:1521/CLCDB" username="test" password="test" />
</Context>