struts 2.5版本启动报错
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.class
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].Standard
网上主流意见为:
- jar包没有拷贝到lib目录下
- struts 2.3过滤器类为org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.class
struts 2.5过滤器为
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.class
可惜我按照网上办法尝试更改依旧没有解决问题,使用2.3版本的jar包重新部署却可以解决问题。最后我去官网重新下载核心jar包,解决了问题。
采用struts,需要核心jar包:
struts2.5核心jar包:commons-fileupload, common-io, common-lang, freemaker, javassist, log4j, ognl, struts2-core.
struts2.3核心jar包:commons-fileupload, common-io, common-lang, freemaker, javassist, ognl, struts2-core.
总结:struts2.5版本的jar包比2.3版本的多了log4j jar包,并且过滤器类名更改为org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter