tomcat请求的资源()不可用

我知道这是一个非常常见的问题,因为我在包括SO在内的多个论坛中发现了许多与此相关的问题。 但我还没有找到解决方案我的web.xml(位于WEB-INF)

  SMSProjectNew  index.html    ReceiveMessagesServlet ReceiveMessagesServlet com.sendreceive.ReceiveMessagesServlet   ReceiveMessagesServlet /ReceiveMessagesServlet   

html页面index.html,位于WebContent文件夹中

     Insert title here   The application started successfully version 1:27 

最后是servlet,ReceiveMessagesServlet,位于src \ com.sendreceive包com.sendreceive中;

 import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ReceiveMessagesServlet extends HttpServlet { private static final long serialVersionUID = 1L; public ReceiveMessagesServlet() { super(); // TODO Auto-generated constructor stub } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request,response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request,response); } protected void processRequest(HttpServletRequest request, HttpServletResponse response) { String responseMessage = request.getParameter("message"); String responseNumber = request.getParameter("number"); System.out.println(responseMessage+responseNumber); } } 

我在eclipse中安装了tomcat插件。 当我右键单击项目然后单击在服务器上运行项目时。 tomcat服务器在eclipse中启动并显示index.html页面。但是当我在字段中输入一些值并单击submit..it给出了404错误..我从过去的2小时起就一直在苦苦挣扎…请帮助..另外..我正在使用这个教程http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html

由于action =“/ ReceiveMessagesServlet”,您收到404错误,请删除斜杠。 尝试使用action =“ReceiveMessagesServlet”。

当您向URL模式添加斜杠时,容器将查找部署名称为“ReceiveMessagesServlet”的Web应用程序。由于这不存在,您将收到404错误。

将应用程序部署到servlet容器中时,URL可能会以标识应用程序的上下文路径为前缀,即该容器中的其他应用程序(即/ReceiveMessagesServlet变为/MyApp/ReceiveMessagesServlet )。

因此,您应该考虑这种可能性并相应地修改您的URL,例如,使用JSTL的

 

或者,没有JSTL:

  

servlet中的错误可能导致Tomcat将其标记为不可用,因为我在服务器日志中得到了:

06/02/2013 13:32:43 org.apache.catalina.core.ApplicationContext log INFO:将servlet标记为不可用06/02/2013 13:32:43 org.apache.catalina.core.StandardWrapperValve调用SEVERE:Allocate servlet Imager的exceptionjava.lang.ClassNotFoundException com.project.test.ImageThumber

您应该查看日志以了解原因。 在我的情况下,一个缺少jar与一些测试类。