Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

404 Error - Can't access Servlet

 
Brendon Lippy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I'm trying to build a basic servlet using Apache Tomcat 5.0. I made a simple servlet:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Test extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException
{
PrintWriter out = response.getWriter();
out.println("Hello World!..");
} /* doGet */
} /* Test */

I compiled this class, and put the .class file into the ROOT/WEB-INF/classes. I tried to access this servlet through a browser using the following URL: http://localhost:8080/servlet/Test
I get the 404 error (cannot access resource). What am I doing wrong?
-Brendon
 
Jason Brawner
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you add the servlet to your deployment descriptor (web.xml)?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic