aspose file tools*
The moose likes Servlets and the fly likes confusion err message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "confusion err message "HTTP method GET is not supported by this URL"" Watch "confusion err message "HTTP method GET is not supported by this URL"" New topic

confusion err message "HTTP method GET is not supported by this URL"

David Westbrook

Joined: Dec 18, 2008
Posts: 16
Ok, so I'm trying to figure out all of this servlet stuff. Here is what I did:

First, using one of the WORKING examples from apache tomcat 6, I took this:

copied it and changed the class name to blabla, so now the line that said:

says this:

and yes, I did name the file and i didn't get compiler err.

I compiled the program and moved the blabla.class file to the same folder that the HelloWorldExample.class file was located. I then added the following lines of code to the web.xml file located in the webapps/examples/WEB-INF folder:

When I go to the URL


it works fine, but when I go to


I get the message:

HTTP method GET is not supported by this URL

And the description:

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

I have read up, and it seems this is a common error which usually occurs because people don't override the super class doGet method provided by the HttpServlet class, but if you look at my code, I obviously do that.

So to recap, I copied WORKING HelloWorldExample servlet and renamed HelloWorldExample to blabla in the java file. I then compiled it and moved blabla.class to the same location as HelloWorldExample.class. I then added to web.xml to configure url mapping.

Was there something else that I missed? Is there something obvious that my frustration is blinding me from? Thanks in advance for the help.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60071

The first thing to do, in order to eliminate it as a possible source of error, is to move your class to a package other than the default.

Yeah, the other class appears to be working, but it's a poor practice and can lead to issues. Let's eliminate it a source of issues and move on if the problem persists. (As well as just getting into a good habit.)

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Westbrook

Joined: Dec 18, 2008
Posts: 16
I didn't really fix this per say. I made a new dynamic web project on eclipse and used the defaults from there and ran it and it worked. I do think that I could have used package manager to fix it like Bear suggested (thnx) but right now I need to move on. If I have time to revisit this later I will, but for now I have a project deadline to meet, so I'm going to keep moving.
I agree. Here's the link:
subject: confusion err message "HTTP method GET is not supported by this URL"
Similar Threads
Setting Up Development Environment Using Ant
Stuck on HelloWorldServlet
executing servlets in apache tomcat
Setting Up Ant/Tomcat Development Enivornment
setting up Tomcat