R
Ryan Gaffuri
My book is about tomcat 4.0. I am using tomcat 5.0. I am trying to run
a servlet on my computer.
I am getting 404 errors.
I have done the following:
1. created: testingServlet.java
2. compiled it to testingSerlvet.class
3. I have the following directory structure setup:
c:\Program Files\Apache\Tomcat_5\webapps\myApp\WEB-INF\classes
4. I navigate to the Tomcat_5\bin directory and type 'startup' to
start tomcat.
5. I have the following web.xml file in the following directory:
c:\Program Files\Apache\Tomcat_5\webapps\myApp\WEB-INF\web.xml
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"><web-app> <servlet>
<servlet-name>testing</servlet-name>
<servlet-class>testingServlet</servlet-class> </servlet>
<servlet-mapping> <servlet-name>testing</servlet-name>
<url-pattern>/servlet/Testing</url-pattern>
</servlet-mapping></web-app>
6. I type the following URL in:
http://localhost:8080/myApp/servlet/testing
7. Here is the code for my class:
import java.io.*;import javax.servlet.*;import
javax.servlet.http.*;public class testingServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException {
response.setContentType("text/html"); PrintWriter out =
response.getWriter(); out.println("<html>");
out.println("<head>"); out.println("<title>Hello
World!</title>"); out.println("</head>");
out.println("<body>"); out.println("<h1>Hello World!</h1>");
out.println("</body>"); out.println("</html>"); }}
8. I get the following errors:
HTTP Status 404 - /myApp/servlet/testing
--------------------------------------------------------------------------------
type Status report
message /myApp/servlet/testing
description The requested resource (/myApp/servlet/testing) is not
available.
a servlet on my computer.
I am getting 404 errors.
I have done the following:
1. created: testingServlet.java
2. compiled it to testingSerlvet.class
3. I have the following directory structure setup:
c:\Program Files\Apache\Tomcat_5\webapps\myApp\WEB-INF\classes
4. I navigate to the Tomcat_5\bin directory and type 'startup' to
start tomcat.
5. I have the following web.xml file in the following directory:
c:\Program Files\Apache\Tomcat_5\webapps\myApp\WEB-INF\web.xml
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"><web-app> <servlet>
<servlet-name>testing</servlet-name>
<servlet-class>testingServlet</servlet-class> </servlet>
<servlet-mapping> <servlet-name>testing</servlet-name>
<url-pattern>/servlet/Testing</url-pattern>
</servlet-mapping></web-app>
6. I type the following URL in:
http://localhost:8080/myApp/servlet/testing
7. Here is the code for my class:
import java.io.*;import javax.servlet.*;import
javax.servlet.http.*;public class testingServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException {
response.setContentType("text/html"); PrintWriter out =
response.getWriter(); out.println("<html>");
out.println("<head>"); out.println("<title>Hello
World!</title>"); out.println("</head>");
out.println("<body>"); out.println("<h1>Hello World!</h1>");
out.println("</body>"); out.println("</html>"); }}
8. I get the following errors:
HTTP Status 404 - /myApp/servlet/testing
--------------------------------------------------------------------------------
type Status report
message /myApp/servlet/testing
description The requested resource (/myApp/servlet/testing) is not
available.