This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Servlets and the fly likes HTTP method GET is not supported by this URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP method GET is not supported by this URL" Watch "HTTP method GET is not supported by this URL" New topic

HTTP method GET is not supported by this URL

Narasimha Raju Naidu
Ranch Hand

Joined: Mar 23, 2007
Posts: 37
hi 2 all,

i am getting the above problem while running my servlet on tomcat 6.0 server

my code:

url: http://localhost:8086/Suji/stu

web.xml file

the response what i am getting is

can any one tell me where i am doing mistake. waiting for yout valuable replies.


Narasimha Raju
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

The big thing to remember is that Java is a case sensitive language.

There is no "Service" method (with an upper case S).
So you haven't overridden any of the required methods needed to support a GET request.

Also, overriding the service method is not a good idea (except in rare cases). It is better to explicitly override doGet and doPost.
If you want the same code to handle both methods, have one call the other or have them both call a user defined method of your own.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Nhat Nguyen

Joined: Jan 09, 2008
Posts: 9

public void Service(ServletRequest req,ServletResponse res) throws ServletException,IOException

this method must be:

public void service(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException

or better:

public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
I agree. Here's the link:
subject: HTTP method GET is not supported by this URL
It's not a secret anymore!