jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes HttpStatsuError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpStatsuError" Watch "HttpStatsuError" New topic


phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
I have created a HelloWorldServlet under Hello project in the package com.devx.example using Myeclipse

My web.xml is:

I have deployed Hello.war on the Jboss server.

When I am saying like this


I got this error:

HTTP Status 404 - /Hello/HelloWorldServlet


type: Status report

message: /Hello/HelloWorldServlet

description The requested resource (/Hello/HelloWorldServlet) is not available.

Apache Tomcat/5.5.20

Can anyone help me in this case? What is the error I am doing here.


[BSouther: Added UBB CODE tags]
[ March 05, 2008: Message edited by: Ben Souther ]
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

There are a few issues that I see.

It's almost always a bad idea to override the service method directly.
Instead override doGet or doPost.

Instead of writing directly to the servletOutputStream, use a printWriter by calling response.getWriter.

Your web.xml heading specifies servlet spec 2.2.
Tomcat 5.5 supports servlet spec 2.4.
This might not be a big problem with this servlet but you are going to run into problems later if you try to learn any of the newer features (filters, listeners, EL, JSTL, etc..).

Lastly, and this is probably what's causing your 404 error, the url-pattern in your mapping specifies /hello but in your url you're requestiong /HelloWorldServlet
Change one or the other.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
I changed to HelloWorldServlet, but it didn't work. I am getting the same error
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Did you restart your app after changing it?
phani kon
Ranch Hand

Joined: Apr 06, 2005
Posts: 251
Yes, I have restarted the app. But still that error is coming
abhishek pendkay
Ranch Hand

Joined: Jan 01, 2007
Posts: 184
There could be a few issues here
1. When you are starting the Server see if your app loaded fine or it is giving any errors while loading , cause sometimes the app does not load and you get the Not Avaiable error

2. If it is loading fine I belive there is some problem with your web.xml servlet mapping tag. can you show your modified web.xml file

The significant problems we face cannot be solved by the same level of thinking which created them – Einstein
SCJP 1.5, SCWCD, SCBCD in the making
Dhana Sen
Ranch Hand

Joined: Mar 05, 2006
Posts: 33

In your case URLPattern is Hello

I agree. Here's the link: http://aspose.com/file-tools
subject: HttpStatsuError
It's not a secret anymore!