• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

getting error while running servlet in tomcat

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have made a simple servlet

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorldServlet 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><title>HelloWorldServlet</title></head>");
out.println("<body><h1>HelloWorldServlet</h1></body>");
out.println("</html>");
}
}
compiled it n placed its class file in

C:\Tomcat 5.5\webapps\practice\WEB-INF\classes

n made one web.xml file n saved it at C:\Tomcat 5.5\webapps\practice\WEB-INF
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app >
<servlet servlet-name="HelloWorldServlet"
servlet-class="HelloWorldServlet"/>

<servlet-mapping url-pattern="/HelloWorldServlet"
servlet-name="HelloWorldServlet"/>
</web-app>

in tomcat i ran it as

http://localhost:8080/practice/HelloWorldServlet
n its giving error
The requested resource (/practice/HelloWorldServlet) is not available.


kindly help me
 
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this DD:

<servlet>
<servlet-name>AAA</servlet-name>
<servlet-class></servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>AAA</servlet-name>
<url-pattern></url-pattern>
</servlet-mapping>

--------------------------
Container cannot reach your app file, so i guess you should rearrange directories and check for your DD

----

this post should be under "Web Component Certification" or "Servlet" section....
 
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic