zoukankan      html  css  js  c++  java
  • 关于tomcat启动时的警告 :Property maxActive is not used in DBCP2, use maxTotal instead. 和 Property maxWait is not used in DBCP2 , use maxWaitMillis instead.

    我们现在用的tomcat大概都是8.5 或是9.0,这些版本的tomcat内置的DBCP2,和以前老版本如tomcat 7的连接池不一样,7.0等老版本用的是DBCP。

    tomcat 7等老版本中,内置连接池时 context.xml文件 的默认配置示例:

    <?xml version="1.0" encoding="UTF-8"?>
    <Context>
      <Resource name="jdbc/day28" auth="Container" type="javax.sql.DataSource"
                   maxActive="100" maxIdle="30" maxWaitMillis="10000"
                   username="root" password="root" driverClassName="com.mysql.jdbc.Driver"
                   url="jdbc:mysql://localhost:3306/day28"/>
    </Context>

    在老版本的tomcat里面关于允许的最大连接数用maxActive来表示,最大等待延用maxWait来表示

    我们现在用的是新版本的tomcat,新版本内置的连接池已经升级了,所以如果我们继续使用这个配置就会出现如下图所示警告:

    警告原文如下:

    七月 05, 2018 1:55:06 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deploying web application directory [D:learnJavaWebapache-tomcatapache-tomcat-9.0.7webappsday28_struts2_final]
    七月 05, 2018 1:55:06 下午 org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
    警告: Name = day28 Property maxActive is not used in DBCP2, use maxTotal instead. maxTotal default value is 8. You have set value of "100" for "maxActive" property, which is being ignored.
    七月 05, 2018 1:55:06 下午 org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
    警告: Name = day28 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.
    七月 05, 2018 1:55:06 下午 org.apache.jasper.servlet.TldScanner scanJars
    信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
    七月 05, 2018 1:55:07 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deployment of web application directory [D:learnJavaWebapache-tomcatapache-tomcat-9.0.7webappsday28_struts2_final] has finished in [1,469] ms

    这个警告其实已经把话说的很明白了,既然8.5,9.0tomcat内置的是DBCP2,已经使用 maxTotal来取代maxActive、使用 maxWaitMillis来取代maxWait,

    因此我们只需要将自己的配置文件中的maxActive替换成maxTotalmaxWait替换成maxWaitMillis即可。

    <?xml version="1.0" encoding="UTF-8"?>
    <Context>
      <Resource name="jdbc/day28" auth="Container" type="javax.sql.DataSource"
                   maxTotal="100" maxIdle="30" maxWaitMillis="10000"
                   username="root" password="root" driverClassName="com.mysql.jdbc.Driver"
                   url="jdbc:mysql://localhost:3306/day28"/>
    </Context>

    警告消失了:

    七月 05, 2018 3:26:15 下午 org.apache.catalina.startup.HostConfig undeploy
    信息: Undeploying context [/day28_struts2_final]
    七月 05, 2018 3:26:15 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deploying web application directory [D:learnJavaWebapache-tomcatapache-tomcat-9.0.7webappsday28_struts2_final]
    七月 05, 2018 3:26:16 下午 org.apache.jasper.servlet.TldScanner scanJars
    信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
    七月 05, 2018 3:26:16 下午 org.apache.catalina.startup.HostConfig deployDirectory
    信息: Deployment of web application directory [D:learnJavaWebapache-tomcatapache-tomcat-9.0.7webappsday28_struts2_final] has finished in [1,087] ms

    附上:DBCP2中配置参数详解链接:http://bsr1983.iteye.com/blog/2092467

    本文参考链接如下:https://blog.csdn.net/vr_jia/article/details/74530389

  • 相关阅读:
    django静态资源转移
    QT5 内置Multimedia开发音乐播放器
    Qt Creator 设置编码格式为 UTF-8
    QT 出错 moc_mainwindow.obj:-1: error: LNK2019: 无法解析的外部符号 " 中被引用...
    linux 安装node, 添加软链接,更改npm安装源
    django.template.exceptions.TemplateDoesNotExist: index.html
    centos下使用virtualenv建立python虚拟环境
    win7上 nginx 出现 403 Forbidden
    django安装xadmin中出现的报错汇总
    centos安装mysql57
  • 原文地址:https://www.cnblogs.com/chenmingjun/p/9268641.html
Copyright © 2011-2022 走看看