Java 我的 Struts2 应用程序收到错误 404:资源不可用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20727181/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 03:48:57  来源:igfitidea点击:

My Struts2 application gets Error 404: Resource not available

javastruts2

提问by Crusaderpyro

I was just trying my first struts2 application. Followed the steps from a tutorial. The link

我只是在尝试我的第一个 struts2 应用程序。按照教程中的步骤操作。链接

    http://localhost:8080/StrutsApp/ 

and the link

和链接

    http://localhost:8080/StrutsApp/getTutorial.action

both give the same 'resource not available' error. I have added the required images of the error, directory structure, struts.xml, web.xml and the tutorialaction class. Also the added jars(latest release from apache) can be seen in the directory structure. Can anyone please help me to solve this problem?

两者都给出相同的“资源不可用”错误。我已经添加了错误、目录结构、struts.xml、web.xml 和tutorialaction 类所需的图像。还可以在目录结构中看到添加的 jars(来自 apache 的最新版本)。任何人都可以帮我解决这个问题吗?

My IDE: Eclipse Kepler

我的 IDE:Eclipse 开普勒

Server: Apache Tomcat 7.0

服务器:Apache Tomcat 7.0

The error

错误

enter image description here

在此处输入图片说明

struts.xml

struts.xml

web.xml

网页.xml

Tutorial action class

教程动作类

采纳答案by Crusaderpyro

Problem is solved.Thanks for your help. There are two commons-lang jars with almost similar names which come in the struts2 zip file as follows:

问题已解决。谢谢您的帮助。struts2 zip 文件中有两个名称几乎相似的 commons-lang jar,如下所示:

  1. commons-lang-x.x.jar
  2. commons-lang3-x.x.jar
  1. commons-lang-xxjar
  2. commons-lang3-xxjar

where x.x is the version number. Notice the '3'after lang in the second jar which is not present in the first jar. The second one commons-lang3-x.x.jar was missing in my application. Had just the first one in the Web-inf/lib folder.

其中 xx 是版本号。注意第二个 jar 中 lang 之后的“3”,第一个 jar 中没有。我的应用程序中缺少第二个 commons-lang3-xxjar。只有 Web-inf/lib 文件夹中的第一个。