This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP method GET is not supported by this URL

 
Kenneth Kristiansen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Pie
Posts: 2270
76
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kenneth,

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

Regards,
Frits
 
Kenneth Kristiansen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im using tomcat..
Url: http://localhost:8080/webtek/test
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic