Reputation: 25143
I am getting compilation error in servlet class while attempting to compile a program. The error is
Access restriction: The type HttpServlet is not accessible
due to restriction on required library D:\Temp\eclipse\plugins\javax.servlet_2.5.0.v201103041518.jar
The error I am getting in the first line itself-
public class Servlet extends HttpServlet
I am using Eclipse indigo and Apache Tomcat 7 for running this code. As I am new to servlet so I am not familiar with this error. Please help me figuring this out.
Upvotes: 0
Views: 770
Reputation: 18302
"Servlet" is already the name of an interface in the Servlet API. If you look at the API Javadoc you can see that in fact javax.servlet.http.HttpServlet
implements javax.servlet.Servlet
. Try using a different name for you class, such as MyServlet
Upvotes: 1