wood burning stoves 2.0*
The moose likes Servlets and the fly likes HTTP Status 405 - 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 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP Status 405 - HTTP method GET is not supported by this URL?" Watch "HTTP Status 405 - HTTP method GET is not supported by this URL?" New topic
Author

HTTP Status 405 - HTTP method GET is not supported by this URL?

Bryan Scarbrough
Ranch Hand

Joined: Aug 08, 2005
Posts: 49
I have written a servlet that will retrieve perform a SQL select and return the results in a table. I have updated the web.xml file to recognise the servlet, but every time I try to load it I get this error.

HTTP Status 405

HTTP method GET is not supported by this URL

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

Here is the code I have:


Can anyone tell me why I am getting this error?

Thanks!


Bryan Scarbrough<br /> <br />Consistency is the last resort of the unimaginative!
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
change this:


to this:


and the same thing for doPost

Also save yourself a lot of trouble and make "out" a method-local variable as well.

-Yuriy
[ August 11, 2005: Message edited by: Yuriy Zilbergleyt ]
Bryan Scarbrough
Ranch Hand

Joined: Aug 08, 2005
Posts: 49
Well, now I went from one error to another.
I did that and now I get the following error:

java.lang.NullPointerException
com.services.select.StudentInfoQueryHttp.doGet(StudentInfoQueryHttp.java:90)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Line 90 of the servlet is pointing to the results of another class. Do I need to first convert that result Object into a string?

If so, what will be the best way to do that (I have tried toString(), but it does not like that)?
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
Line 90 of the servlet is pointing to the results of another class. Do I need to first convert that result Object into a string?

The error says that that result is null, so no conversion will help. You just have to make sure that either that class never returns a null value, or check the result once you get it and do something different when it's null.

-Yuriy
Bryan Scarbrough
Ranch Hand

Joined: Aug 08, 2005
Posts: 49
Yeah, working that now... Any clues? I have run the query in both MySQL and PHP My Admin with the same results, so I know it is not that.

Maybe the DatabaseUtilities method I am calling?
Bryan Scarbrough
Ranch Hand

Joined: Aug 08, 2005
Posts: 49
FIXED IT!!! Silly me...used the wrong Dbase password!!

Thanks for all your help!
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP Status 405 - HTTP method GET is not supported by this URL?
 
Similar Threads
HTTP error 405
Calling a method, quick answer
getting 500 error when trying to run a servlet
404 error. Can't find resource?
data grid with edit and delete options