• Post Reply Bookmark Topic Watch Topic
  • New Topic

Apache Tomcat/4.0.1 - HTTP Status 404  RSS feed

 
Rida Abrahams
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I am running a servlet using Tomcat 4.0.1 on Windows XP Professional.
The servlet is called Conti and resides in the following directory structure
on my home pc: C:\jakarta-tomcat-4.0.1\webapps\conti\WEB-INF\classes
I have created a web.xml file which does have the correct servlet name in the servlet tags as shown here:
<?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>Conti</servlet-name>
<servlet-class>Conti</servlet-class>
</servlet>
</web-app>
The servlet compiles with no errors.
When i enter the following url in my address bar: http://localhost:8080/conti/servlet/Conti
I recieve the following error:
Apache Tomcat/4.0.1 - HTTP Status 404 - /conti/servlet/Conti
type Status report
message /conti/servlet/Conti
description The requested resource (/conti/servlet/Conti) is not available.

I have recompiled my servlet and restarted Tomcat several times already.
Could someone please help me.
Thanks
Fathima Khan.
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you done servlet mapping in you deployment descriptor(web.xml)? if not do it as following
<servlet-mapping>
<servlet-name>Conti</servlet-name>
<url-pattern>/conti</url-pattern>
</servlet-mapping>
and now try to run the servlet using http://localhost:8080/conti
may be this will help.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. For best results, do NOT leave your class in the default package like this:

Put your class in a package and declare it properly.

2. Don't use the /servlet style of URL - see this FAQ discussion of the invoker servlet.
Bill
 
Nitin Mehhta
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think William is right in the observation. even I had faced the same problems in Tomcat when I had put my classes in the default package. creating a separate package solved the issue.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!