开发者社区> 问答> 正文

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

控制台错误信息:

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"/>

 


 

展开
收起
爱吃鱼的程序员 2020-06-22 19:54:59 550 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    用代码的方式把错误贴出来吧,格式可能好看点、<divclass="ref">

    引用来自“廖凯”的答案

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

    <imgsrc="http://static.oschina.net/uploads/space/2015/0906/164223_ekoD_1051990.bmp"alt="">

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

    加了还是报错。<spanstyle="font-size:13.3333px;">怎么解决的啊?我也遇到了同样的问题

    2020-06-22 19:55:17
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
基于Web前端的可用性优化 立即下载
Web应用系统性能优化 立即下载
高性能Web架构之缓存体系 立即下载