zoukankan      html  css  js  c++  java
  • 在Eclipse IDE进行Struts开发时提示错误:java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher的解决办法

    If you have...

    1. included all necessary jars
    2. Configured build path correctly
    3. added them all in deployment assembly
      Correctly.

    then also you getting "java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher" error then you could be doing below things wrong.

    solution:

    check your struts2-core-x.x.jar version.

    -->if it is struts2-core-2.5.jar then change your filter class tag value in web.xml to

    <filter-class>
         org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
    </filter-class>

    -->if it is struts2-core-2.1.3.jar then change your filter class tag value in web.xml to

    <filter-class>
         org.apache.struts2.dispatcher.FilterDispatcher
    </filter-class>

    FilterDispatcher is deprecated since Struts 2.1.3. If you are working with older versions then user above solution.

    -->if it is struts2-core-2.3.X.jar then change your filter class tag value in web.xml to

    <filter-class> 
        org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    </filter-class>

    Reason behind all this is struts 2 controllers are placed in different location in different version of struts2-core jar and some time they are called by different name as you can see in 2.1.3.

    Thank you!

    需要注意的是:

      在struts2.1版本之前,所使用的核心过滤器类是 org.apache.struts2.dispatcher.FilterDispatcher,从struts2.1版本之后,已经不推荐使用,而是使用org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter类。但是当struts版本发展到2.5之后的版本时,推荐将类完全名称中的ng去掉,即使用org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter类。

  • 相关阅读:
    向代码致敬,寻找你的第83行
    佛系程序员的月薪五万指南
    再谈全局网HBase八大应用场景
    如何避免HBase写入过快引起的各种问题
    阿里云MaxCompute被Forrester评为全球云端数据仓库领导者
    为了让开发者写MaxCompute SQL更爽,DataWorks 增强SQL 编辑器功能
    《CDN 之我见》原理篇——CDN的由来与调度
    Installing GCC (C++ Compiler and Development Tools)
    Gems installation
    Fedora23
  • 原文地址:https://www.cnblogs.com/rainbow70626/p/11161144.html
Copyright © 2011-2022 走看看