• 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:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Need help

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all
I am getting the following error while running the servlet in the url
http://localhost:8080/servlet/HelloServlet
I am using Tomcat 4.1.24
HTTP Status 404 - /servlet/HelloServlet
type Status report message /servlet/HelloServlet
description The requested resource (/servlet/HelloServlet) is not available.
Apache Tomcat/4.1.24
-----------------------------
HelloServlet.java
=============
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloServlet extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">\n";
out.println(docType +
"<HTML>\n" +
"<HEAD><TITLE>Hello</TITLE></HEAD>\n" +
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1>Hello</H1>\n" +
"</BODY></HTML>");
}
}
I have put the HelloServlet.class file inside Tomcat 4
F:\Program Files\Apache Group\Tomcat 4.1\webapps\ROOT\WEB-INF\classes directory
Please guide me where am I going wrong.
Thanks in advance
Regards
Johnson
 
hired gun
Posts: 250
MS IE Oracle Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had the same problem and was able to resolve it by uncommenting the following section in the web.xml file in the conf directory of your Tomcat installation. I am using the same version: 4.1.24

This is talked about at this website Configure Tomcat. Look at step 3 "Enable the Invoker Servlet".
 
Johnson K Jose
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi John
thanks for the mail.
I have uncommanded the same, still it is not working. now i just copied the file HelloServlet.class in to the followng dir.
F:\Program Files\Apache Group\Tomcat 4.1\webapps\examples\WEB-INF\classes
and tried the url
http://localhost:8080/examples/servlet/HelloServlet it is working? still I don't know what is happening. can any one please give me some light
Thanks in advance
Regards
Johnson
 
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic