Servlet "requested resource (/myApp/) is not Available
843842Jul 22 2008 — edited Jul 24 2008Hai Friends
I have created a new servlet file and try to execute it. When i enter the URL "http://localhost:8080"
and select my application "myApp" which is in tomcat manager, I've got the error such as
HTTP Status 404 - /myApp/
type Status report
message /myApp/
description The requested resource (/myApp/) is not available.
Things which i have done..
1. I have created a folder myApp in D:\Tomcat\Tomcat 6.0\webapps
2. In D:\Tomcat\Tomcat 6.0\webapps\myApp\ i have created WEB-INF\classes folder
3. Now i wrote a servlet file, compile that file and put both the java and class file in the WEB-INF\classes
folder
4. After which i have created a web.xml file and put it into WEB-INF folder
5. when i try to execute it im getting the error which i have given above
This is the coding which i have written...
TestingServlet.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class TestingServlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>Servlet Testing</TITLE>");
out.println("</HEAD>");
out.println("<BODY>");
out.println("Welcome to the Servlet Testing Center");
out.println("</BODY>");
out.println("</HTML>");
}
}
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>TestingServlet</servlet-name>
<servlet-class>TestingServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestingServlet</servlet-name>
<url-pattern>/servlet/Testing</url-pattern>
</servlet-mapping>
</web-app>
Can anybody tell me the mistake what i did in the program. Or else give me a suggestion to run the file..
Should i want to make any change in the "context.xml" "server.xml" file..