Apache Tomcat error : The requested resource is not available

三世轮回 提交于 2019-12-24 10:56:09

问题


I am following this tutorial to build my first Struts2 example.

My project name (and war file also) is HelloWorld and whenever I try to access http://localhost:8080/HelloWorld/index.jsp I get

The requested resource is not available.

I have my war file in tomcat webapps directory and tomcat is running fine.

Where am I going wrong?


回答1:


That tutorial is OLD.

It still uses org.apache.struts2.dispatcher.FilterDispatcher , that is a deprecated filter since Struts 2.1.8.

You need to use the new filter: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.

Then ensure you have both the filter and the filter-mapping correctly set in your web.xml:

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

<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>


来源:https://stackoverflow.com/questions/26124627/apache-tomcat-error-the-requested-resource-is-not-available

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!