The HTTP status 405 is a very common error message in Java Servlet.

HTTP Status 405 - HTTP method GET is not supported by this URL
 
type Status report
message HTTP method GET is not supported by this URL
description The specified HTTP method is not allowed for the requested resource
 (HTTP method GET is not supported by this URL).
Apache Tomcat/6.0.20

Solution

This is always caused by following two reasons

1) You do not have a valid doGet() method, when you type the servlet’s path in address bar directly, the web container like Tomcat will try to invoke the doGet() method.

	public void doGet(HttpServletRequest request, HttpServletResponse response)
	throws IOException{
		....		
	}

2) You made a HTTP post request from a HTML form, but you do not have a doPost() method to handle it. The doGet() can not handle the “Post” request.

	public void doPost(HttpServletRequest request, HttpServletResponse response)
	throws IOException{
		....		
	}