This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Can you check and verify whether the servlet API JAR is available in your Tomcat installation. The JAR is typically named servlet-api.jar.
I recall a similar error - could not instantiate servlet class - which arose due to the absence of that JAR file. In a normal Tomcat installation this JAR is always included by default, but still you might want to check on that first.
thanks for your valuable suggestions ,the strange thing is that once again i have written simple servlet and deployed it in servlet container and working fine still i am not getting that whats went wrong in my earlier code looks same and onething i did is restarted the system,thats it
author and jackaroo
As I said - the error message states that you did not have your class defined as public previously. The code you posted shows that it is public, so at some point you may have changed the code without redeploying. Now that you have redeployed with a public class the problem has gone away.
You can prove this yourself by removing the public access modifier from your class on your working application, recompiling and redeploying - you should get the same error you were previously seeing.