关于tomcat启动时的警告 :maxActive is not used inDBCP2
来源:互联网 发布:软件项目实施流程图 编辑:程序博客网 时间:2024/05/18 02:32
我们现在用的tomcat大概都是8.5 或是9.0,这些版本的tomcat内置的DBCP2,和以前老版本如tomcat 7的连接池不一样,7.0等老版本用的是DBCP。
但是做开发时我们很多人或许都看了这样的博客,如孤傲苍狼大神的文章
http://www.cnblogs.com/xdp-gacl/p/4002804.html
里面给出了一个使用tomcat内置连接池时context的配置范例:
1 <Context>2 <Resource name="jdbc/datasource" auth="Container"3 type="javax.sql.DataSource" username="root" password="XDP"4 driverClassName="com.mysql.jdbc.Driver" 5 url="jdbc:mysql://localhost:3306/jdbcstudy"6 maxActive="8" maxIdle="4"/>7 </Context>里面关于允许的最大连接数是用maxActive来代表,但是孤傲苍狼大神用的毕竟是老版本的tomcat,我们用的时新版本的tomcat,新版本内置的连接池已经升级了,所以如果我们继续使用这个配置就会出现警告,
org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory.getObjectInstanceName = wifiAuth Property maxActive is not used inDBCP2, usemaxTotal instead.maxTotal default value is 8. You have set value of "100" for"maxActive" property, which is being ignored.
这个警告其实已经把话说的很明白了,既然8.5,9.0tomcat内置的时DBCP2,已经使用maxTotal来取代maxActive,因此我们只需要将自己的配置文件中的
maxActive替换成maxTotal即可。最后附上DBCP2中配置参数详解的连接:
http://bsr1983.iteye.com/blog/2092467
PS:最后我再啰嗦一句,麻烦各位大神在发帖子时能够正确回答问题,不然可能有点误导像我这样的菜鸟。比如这位大神对于这个警告的回答,似乎答非所问,
http://www.jianshu.com/p/059f47952b78
摘录这位大神的部分内容:
///////////////////////////////////
先检查了下spring中数据源的配置,发现是没怎么修改,那就基本确认是tomcat7和9的问题。
那就对比了2个版本的tomcat配置文件context.xml ,也一样
那基本可以确认是tomcat的版本不一致导致的。为了节约时间,可以选择不使用低版本就好了。
/////////////////////////////////////////
看这内容我真是心理糊涂,难道你用新版本的tomcat 9,并且用maxActive就不报警了?
- 关于tomcat启动时的警告 :maxActive is not used inDBCP2
- J2EE中关于tomcat的maxIdle、maxActive、maxActive相关配置
- intellij 启动tomcat 1099 is used
- 关于The dependency `AFNetworking` is not used in any concrete target的问题
- 关于Cocopods错误 is not used in any concrete target
- OpenSSL library is not used
- OpenSSL library is not used
- 关于The function get must be used with a prefix when a default namespace is not specified的错误
- 关于启动Tomcat6.x时的 Document base ……does not exist or is not a readable directory 错误
- Tomcat启动警告
- Tomcat启动--警告: [SetPropertiesRule]
- iOS中Data argument not used by format string的警告处理
- loadrunner启动web tour-Could not open port 1080-Port is already used by another server
- 解决编译时出现的警告:format string is not a string literal (potentially insecure)
- 解决编译时出现的警告:format string is not a string literal (potentially insecure)
- 提示is not a symbolic link警告的去除方法
- 关于Error:Minifying the variant used for tests is not supported when using Jack.
- MATLAB Toolbox Path Cache is out of date and is not being used的解决
- 在串口通信开发中实现自动查找串口端口的方法
- 使用Qt5.7.0 VS2015版本生成兼容XP的可执行程序
- 解决redis强制关闭问题
- 支付宝支付遇到的各种坑及解决问题
- 开展全网整合营销推广步骤详解
- 关于tomcat启动时的警告 :maxActive is not used inDBCP2
- 有关iOS定位中的蓝条问题
- git --mixed --soft --hard之间的区别
- 根类Object包含的方法
- Linux系统如何平滑生效NAT
- java直接读取客户端txt文件 + JavaWeb中读取文件资源的路径问题
- C++11 shared_ptr共享智能指针
- AndroidStudio将Jar设置成外部引用(external refrence) 只参与编译
- Kafka auto.offset.reset值详解