web中配置ehcache的filter 启动tomcat报错

皛尛惢 发布于 2013/04/26 11:05
阅读 2K+
收藏 0

控制台错误信息:

2013-4-26 11:02:11 net.sf.ehcache.constructs.web.filter.Filter init
严重: Could not initialise servlet filter.
java.lang.NullPointerException
        at net.sf.ehcache.CacheManager.replaceCacheWithDecoratedCache(CacheManager.java:874)
        at net.sf.ehcache.constructs.web.filter.CachingFilter.doInit(CachingFilter.java:87)
        at net.sf.ehcache.constructs.web.filter.Filter.init(Filter.java:196)
        at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
        at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
        at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
        at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4001)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4651)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
        at org.apache.catalina.core.StandardService.start(StandardService.java:519)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

web.xml内容:

  <filter>
    <filter-name>SimplePageCachingFilter</filter-name>
    <filter-class>net.sf.ehcache.constructs.web.filter.SimplePageCachingFilter</filter-class>
  </filter>
  <!-- This is a filter chain. They are executed in the order below. Do not change the order. -->
  <filter-mapping>
    <filter-name>SimplePageCachingFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

ehcache.xml内容:

 <cache name ="SimplePageCachingFilter"
           maxElementsInMemory ="10"
           maxElementsOnDisk ="10"
           eternal ="false"
           overflowToDisk ="true"
           diskSpoolBufferSizeMB ="20"
           timeToIdleSeconds ="10"
           timeToLiveSeconds ="10"
           memoryStoreEvictionPolicy ="LFU"/>

 


 

加载中
0
书一
书一
用代码的方式把错误贴出来吧,格式可能好看点、
0
皛尛惢
皛尛惢

引用来自“廖凯”的答案

用代码的方式把错误贴出来吧,格式可能好看点、

好的,再贴了一次

0
sumy-lu
sumy-lu

你的ehcache.xml 中需要增加 name="SimplePageCachingFilter" 的cache 配置项,今天我也遇到了就是这样解决的。

济南大飞哥
济南大飞哥
加了还是报错。
0
a
anhuoren
怎么解决的啊?我也遇到了同样的问题
返回顶部
顶部