在eclipse中运行servlet会导致服务器启动失败

时间:2015-09-01 16:25:01

标签: java eclipse jsp tomcat servlets

每当我想在Tomcat7.0上从eclipse运行servlet时,服务器启动就会失败。我从一个星期开始练习jsp和servlet,一切都很好,直到今天早上,突然我的系统意外关闭,从那时起我就面临着这个问题。我尝试了所有可能的方法,例如删除服务器和创建新服务器等,但最后This instruction helps me

 You need to copy the required commons jars into your /WEB-INF/lib folder as well.

commons-io-2.4.jar
commons-fileupload-1.3.1.jar
The reason is that just adding the jar dependencies to your Eclipse project's build path does not make them automatically available on Tomcat. Since, the dependencies are missing (not found in the lib folder) your web app's deployment fails.

我还有一个问题和一个问题。问题是,我是否必须在我项目的所有/ WEB-INF / lib文件夹中添加上面提到的两个Jar文件?问题是虽然我的服务器运行没有任何错误但它无法运行servlet文件。我收到这个错误。它只发生在servlet上,jsp或html文件没有问题。我试过创建三个以上的新项目进行测试但结果与下面相同。

HTTP Status 404 - /Register

--------------------------------------------------------------------------------

type Status report

message /Register

description The requested resource is not available.

1 个答案:

答案 0 :(得分:0)

将列出的jar文件(commons-io-2.4.jar和commons-fileupload-1.3.1.jar)添加到项目的WEB-INF / lib文件夹中(如果它没有&#t; t存在,创建文件夹)。您只在该servlet中获取错误的原因可能是因为您从该特定servlet中的jar文件运行代码。