【问题标题】:Apache Tomcat error : The requested resource is not availableApache Tomcat 错误:请求的资源不可用
【发布时间】:2014-09-30 15:30:16
【问题描述】:

我正在关注this tutorial 来构建我的第一个 Struts2 示例。

我的项目名称(以及 war 文件)是 HelloWorld 并且每当我尝试访问 http://localhost:8080/HelloWorld/index.jsp我明白了

请求的资源不可用。

我在 tomcat webapps 目录中有我的 war 文件,并且 tomcat 运行良好。

我哪里错了?

【问题讨论】:

标签: jsp url tomcat struts2 struts


【解决方案1】:

那个教程是旧的。

它仍然使用org.apache.struts2.dispatcher.FilterDispatcher,即deprecated filter since Struts 2.1.8

您需要使用新的过滤器:org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

然后确保您在 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>

【讨论】:

  • org.apache.catalina.core.StandardContext filterStart SEVERE: 异常启动过滤器 struts2 java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
猜你喜欢
  • 2012-09-12
  • 2015-10-30
  • 2015-03-09
  • 1970-01-01
  • 2015-11-05
  • 2012-03-19
  • 2017-01-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多