Tomcat

Overview

  • 在tomcat 5.5之前,Context体现在/conf/server.xml中的Host里的元素,它由Context接口定义。
  • 每个Context元素代表了运行在虚拟主机上的单个Web应用。
  • 在tomcat 5.5之后,不推荐在server.xml中进行配置,而是在/conf/context.xml中进行独立的配置。因为server.xml是不可动态重加载的资源,服务器一旦启动了以后,要修改这个文件,就得重启服务器才能重新加载。而context.xml文件则不然,tomcat服务器会定时去扫描这个文件。一旦发现文件被修改(时间戳改变了),就会自动重新加载这个文件,而不需要重启服务器。

Configuration

启动告警

07-Mar-2017 11:28:00.620 WARNING [RMI TCP Connection(2)-127.0.0.1] 
org.apache.catalina.webresources.Cache.getResource Unable to add the resource at 
[/WEB-INF/classes/org/hibernate/jpa/orm_2_1.xsd] 
to the cache because there was insufficient free space available after evicting expired cache entries - 
consider increasing the maximum size of the cache


<!-- 直接关闭缓存 -->
<Resources cachingAllowed="false" />
<!-- 缓存的配置默认是开启的,大小是10240KB,这里配置成100M(单位是KB) -->
<Resources cachingAllowed="true" cacheMaxSize="102400"/>

cachingAllowed - 是否允许启用静态资源(HTML、图片、声音等)的缓存。默认值为true。
cacheMaxSize - 设置静态资源缓存的最大值,单位为K。

Reference

https://tomcat.apache.org/tomcat-9.0-doc/config/resources.html

原文地址:https://www.cnblogs.com/duchaoqun/p/12572558.html