0

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.

Jainendra
  • 24,713
  • 30
  • 122
  • 169
  • a similar issue has resolutions at **[here](http://stackoverflow.com/questions/860187/access-restriction-on-class-due-to-restriction-on-required-library-rt-jar)** – Ravinder Reddy Apr 27 '12 at 08:07
  • First,delete the JRE System Libraries. Then,import JRE System Libraries again. Source: http://stackoverflow.com/questions/860187/access-restriction-on-class-due-to-restriction-on-required-library-rt-jar – htulsiani Apr 27 '12 at 09:04

1 Answers1

1

"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

Stewart
  • 17,616
  • 8
  • 52
  • 80