问题描述
我正在使用eclipse j2ee helios 3版本构建一个动态Web项目.一切正常..但是突然有一天,当我打开Eclipse时,在项目浏览器中可见的所有ear和jre库都消失了.之后,我不得不将与其相关的所有库手动放入eclipse/projects文件夹/web inf/lib的工作区中.我确实将servlet-api.jar放在项目的lib文件夹中,但这给了我一些validate jar错误.因此,我从lib文件夹中将其删除,但是现在当我尝试运行servlet as->在服务器上运行时,出现此错误:
I am building a dynamic web project using eclipse j2ee helios 3 version. Everything was working fine..but suddenly one day, when I opened the eclipse, all the ear and jre libraries which was visible in project explorer were gone. And after that I had to put all the libraries related to it manually inside workspace of eclipse/projects folder/web inf/ lib. I did put the servlet-api.jar inside the lib folder of the project, but it was giving me some validate jar error. So, I removed it from the lib folder, but now when i am trying to run the servlet run as-> run on server, I am getting this error:
HTTP Status 404 -
--------------------------------------------------------------------------------
type Status report
message
description The requested resource () is not available.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.30
URL也很奇怪:
http://localhost:8080/cPEP_UI/WEB-INF/classes/Engine_rurl_delete.java
有什么主意吗?!
推荐答案
您可以通过右键单击项目>属性>项目构面管理动态Web项目构面.至少必须检查Dynamic Web Module和Java.您可以通过右键单击项目>属性">目标运行时" 管理动态Web项目目标运行时(包含必需的库).至少一台服务器必须关联.首先,您应该不将servlet容器特定的库放在webapp的/WEB-INF/lib
中.这不是正确的方法.
You can manage the dynamic web project facets by Rightclick project > Properties > Project Facets. At least Dynamic Web Module and Java must be checked. You can manage the dynamic web project targeted runtime (which contains the necessary libraries) by Rightclick project > Properties > Targeted Runtime. At least one server must be associated. You should above all not put servletcontainer specific libraries in webapp's /WEB-INF/lib
. This is not the right way to do.
如果徒劳无功或者您不了解这些秘密的含义/工作原理,我建议您备份代码,扔掉该项目并创建一个新项目.然后注意项目属性/设置.
If in vain or you don't understand the undercovers meaning/working of those, I'd suggest to backup the code, throw away the project and create a new one. And then be careful with project properties/settings.
这篇关于Eclipse未检测到servlet库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!