【开源中国 APP 全新上线】“动弹” 回归、集成大模型对话、畅读技术报告”
ehcache 报错 。。 难道一个ehcache只能有一个cache name??java.lang.ClassNotFoundException: net.sf.ehcache.constructs.web.filter.cach 我在ehcache配置一个cache配置是不会报错 如果多个会报错 求解释
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true"
monitoring="autodetect" dynamicConfig="true">
<diskStore path="c:" />
<defaultCache maxElementsInMemory="2" eternal="false"
timeToIdleSeconds="1" timeToLiveSeconds="1" overflowToDisk="false"
memoryStoreEvictionPolicy="LRU" />
<cache name="cache3" maxElementsInMemory="10" maxElementsOnDisk="10"
eternal="false" overflowToDisk="true" timeToIdleSeconds="7200"
timeToLiveSeconds="14000" memoryStoreEvictionPolicy="LRU">
</cache>
<cache name="cache2" maxElementsInMemory="1" maxElementsOnDisk="1"
eternal="false" overflowToDisk="true" timeToIdleSeconds="10"
timeToLiveSeconds="20" memoryStoreEvictionPolicy="LRU" />
<cache name="cache1" maxElementsInMemory="300" maxElementsOnDisk="300"
eternal="false" overflowToDisk="true" timeToIdleSeconds="200"
timeToLiveSeconds="50" memoryStoreEvictionPolicy="LRU" />
<!-- timeToIdleSeconds:对象空闲时间,指对象在多长时间没有被访问就会失效。只对eternal为false的有效。默认值0,表示一直可以访问。
timeToLiveSeconds:对象存活时间,指对象从创建到失效所需要的时间。只对eternal为false的有效。默认值0,表示一直可以访问。 -->
<cache name="cache4" maxElementsInMemory="200" maxElementsOnDisk="200"
eternal="false" overflowToDisk="true" timeToIdleSeconds="200"
timeToLiveSeconds="50" memoryStoreEvictionPolicy="LRU" />
</ehcache>
web
<filter>
<filter-name>cache2</filter-name>
<filter-class>net.sf.ehcache.constructs.web.filter.cache2</filter-class>
</filter>
<filter>
<filter-name>cache3</filter-name>
<filter-class>net.sf.ehcache.constructs.web.filter.cache3</filter-class>
</filter>
<filter-mapping>
<filter-name>cache3</filter-name>
<url-pattern>/bnHome/guide.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>cache2</filter-name>
<url-pattern>/bnHome/new.do</url-pattern>
</filter-mapping>
求解释 @红薯
++++!
把详细的异常贴出来
@红薯 我们社区用到大量的缓存 修的数据很少
@红薯 @红薯 @红薯 @红薯 @红薯
java.lang.ClassNotFoundException: net.sf.ehcache.constructs.web.filter.cache2
ehcache 的 web 版需要另外一个 jar 包吧? 我也没用过
我用的是web 包 但是就是找不到类 好纠结
@红薯
<filter>
<filter-name>SimplePageCachingFilter</filter-name>
<filter-class>net.sf.ehcache.constructs.web.filter.SimplePageCachingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SimplePageCachingFilter</filter-name>
<url-pattern>/bnHome/guide.do</url-pattern>
</filter-mapping>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true"
monitoring="autodetect" dynamicConfig="true">
<cache name="guideCache" maxElementsInMemory="10"
maxElementsOnDisk="10" eternal="false" overflowToDisk="true"
timeToIdleSeconds="7200" timeToLiveSeconds="1400"
memoryStoreEvictionPolicy="LRU" >
</cache>
<cache name="topicByCreateDate" maxElementsInMemory="1"
maxElementsOnDisk="1" eternal="false" overflowToDisk="true"
timeToIdleSeconds="10" timeToLiveSeconds="20"
memoryStoreEvictionPolicy="LRU" />
<cache name="SimplePageCachingFilter" maxElementsInMemory="300"
maxElementsOnDisk="300" eternal="false" overflowToDisk="true"
timeToIdleSeconds="200" timeToLiveSeconds="50"
memoryStoreEvictionPolicy="LRU" />
<!-- timeToIdleSeconds:对象空闲时间,指对象在多长时间没有被访问就会失效。只对eternal为false的有效。默认值0,表示一直可以访问。
timeToLiveSeconds:对象存活时间,指对象从创建到失效所需要的时间。只对eternal为false的有效。默认值0,表示一直可以访问。 -->
<defaultCache maxElementsInMemory="10000" eternal="false"
timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true"
maxElementsOnDisk="10000000" diskPersistent="false"
diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU" />
<cache name="topicList" maxElementsInMemory="200"
maxElementsOnDisk="200" eternal="false" overflowToDisk="true"
timeToIdleSeconds="200" timeToLiveSeconds="50"
memoryStoreEvictionPolicy="LRU" />
</ehcache>
这样就可以 也可以正常运用到效果
难道只能配置一个???
slf4j-api-1.5.8.jar
slf4j-log4j12.jar
把这两个jar包加上...