wood burning stoves*
The moose likes Web Component Certification (SCWCD/OCPJWCD) 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
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HTTP method GET is not supported by this URL" Watch "HTTP method GET is not supported by this URL" New topic
Author

HTTP method GET is not supported by this URL

Kenneth Kristiansen
Greenhorn

Joined: Mar 01, 2011
Posts: 2
Hi
Im new at Servlets and ive created a simpel servlet called Test.
Ive got a xml file called web.xml.

When i run the servlet in Tomcat i got this error:

The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL)

Thanks

KenKri



b]Test.java:[/b]





Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1632
    
  23

Hi Kenneth,

What is your directory structure? and what is the URL you are using?

Regards,
Frits
Kenneth Kristiansen
Greenhorn

Joined: Mar 01, 2011
Posts: 2
im using tomcat..
Url: http://localhost:8080/webtek/test
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1753
    
    7

Your web.xml isn't valid, but I assume that's a copy-paste error.
The problem is in the method signatures of doGet() and doPost().
You've reversed the order of the parameters. That means that these methods are not valid overrides.
If you annotate methods that are supposed to override a method of a superclass, you should always add the @Override annotation.
It will help you catch stuff like this really easily at compile time


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
 
Don't get me started about those stupid light bulbs.
 
subject: HTTP method GET is not supported by this URL
 
Similar Threads
HFSJ book: Cookie example chapter 6 plz Help :(
really simple servlets,but why second one not work
can't print after post doFilter
filters vs RequestDispatcher's include() method
HTTP POST-Method not supported by this URL.