• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Apache Tomcat/4.0.1 - HTTP Status 404

 
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.
 
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.
 
Author and all-around good cowpoke
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
 
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.
 
The only cure for that is hours of television radiation. And this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic