This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply 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
Rancher

Joined: Apr 07, 2010
Posts: 1041

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: 1409

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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: HTTP method GET is not supported by this URL
 
Similar Threads
filters vs RequestDispatcher's include() method
can't print after post doFilter
HTTP POST-Method not supported by this URL.
really simple servlets,but why second one not work
HFSJ book: Cookie example chapter 6 plz Help :(