• 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
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

HttpStatsuError

 
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


http://localhost:8080/Hello/HelloWorldServlet

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.


Thanks



[BSouther: Added UBB CODE tags]
[ March 05, 2008: Message edited by: Ben Souther ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
phani kon
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I changed to HelloWorldServlet, but it didn't work. I am getting the same error
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you restart your app after changing it?
 
phani kon
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I have restarted the app. But still that error is coming
 
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://localhost:8080/<WebContext/WARName>/URLPatter

In your case URLPattern is Hello

Cheers
Dhana
 
Beware the other head of science - it bites! Nibble on this message:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic