|
Web page (http) error status 405
Running his first Java Servlet today, one of my delegates reported an HTTP status 405 from his code when he tried to browse to it. A new one on me ... I am used to a good number of other return codes, but hadn't seen this before.
It turns out that the cause was the lack of an appropriate doGet method in the Servlet class; in my delegate's case he had provided a doGet but with the wrong type of parameters, so instead of providing a method that Tomcat could call up he had provided what was, in effect, an internally available method only. I was able to reproduce the error later for the purpose of this note by simply mis-spelling doGet as doget ... Capital G to lower case g.
Wrong:
public void doget ( HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException {
Right:
public void doGet ( HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException {
Here are some other common 400 series errors we come across, and their typical causes to help you troubleshoot:
400 - Bad request
Typically this is caused by a user writing his own web client (for example using Web 2 techniques) and so making an illegal instruction call to the server
403 - Forbidden
A file exists on the server that is mapped to the URL that was given, but that file is not readable by the web server process. Typically, this error occurs when the web site administrator is uploading a file via FTP or copying it into place and gets the file permissions or ownership wrong.
404 - Not Found
The most common of the lot. The request was valid, but doesn't point to anything which exists on the server. It could be that the user (at the browser) has mistyped a URL, it could be that there's a broken link on a web page pointing at thin air, and it could be that a file that should exist on the server doesn't, or has been accidentally deleted. You will also get a lot of 404 errors in your server logs relating to malicious software that's poking around looking for holes in your security!
401 - Unauthorized
The page exists, but the user has failed to enter a correct user name and passwordd to access it. See .htpasswd in the Apache documentation. (written 2008-01-12 01:06:18)
| Commentator | says ... | | Leah: | Just a note to add that 403 - Forbidden is also returned when a deny by ip address or other parameter is used in an .htaccess file. (comment added 2008-01-14 13:55:01) |
Associated topics are indexed under A207 - Web Application Deployment - HTTPA606 - Web Application Deployment - Apache httpd - log files and log toolsA654 - Web Application Deployment - Configuring and Controlling Tomcat
Some other Articles
Comments on proposed Asda Superstore for MelkshamOngoing Image Copyright Issues, PHP and MySQL solutionsScript to present commonly used images - PHPFlooding by Asda-s proposed new supermarketWeb page (http) error status 405Java, sorting, ArrayList example, genericsJava - using super to call a method in the parent classFirst Class Java. First step and moving forward.Climate change, renewable resources and paper v plasticJava is a dynamic language .... (and comparison)
|
2259 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46 at 50 posts per page
This is a page archived from The Horse's Mouth at
http://www.wellho.net/horse/ -
the diary and writings of Graham Ellis.
Every attempt was made to provide current information at the time the
page was written, but things do move forward in our business - new software
releases, price changes, new techniques. Please check back via
our main site for current courses,
prices, versions, etc - any mention of a price in "The Horse's Mouth"
cannot be taken as an offer to supply at that price.
Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).
|
|