HowToDoInJava

  • Java 8
  • Regex
  • Concurrency
  • Best Practices
  • Spring Boot
  • JUnit5
  • Interview Questions
  • Dark Mode

[Solved] The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path in Eclipse

By Lokesh Gupta | Filed Under: Eclipse

If you are facing this error after importing an existing maven project into your eclipse IDE, then it means that http-servlet is not available in the project’s class path and you must include it.

Error looks like this.

Java Build Path Error
Java Build Path Error

Solution

To include http-servlet into your class path, you have two options:

1) Add target runtime

In this solution, you can add desired server runtime into your application as project facet. As runtime servers have already servlet runtime dependencies, they get included into your project and hence error is gone.

Update Project Runtime

2) Add maven dependency

Another option is include the servlet dependency through maven itself. This will also fix the error.

<dependency>
	<groupId>javax.servlet</groupId>
	<artifactId>servlet-api</artifactId>
	<version>2.5</version>
</dependency>

Happy Learning !!

TwitterFacebookLinkedinRedditPocket

About Lokesh Gupta

A family guy with fun loving nature. Love computers, programming and solving everyday problems. Find me on Facebook and Twitter.

22
Leave a Reply

This comment form is under antispam protection
18 Comment threads
4 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
20 Comment authors
This comment form is under antispam protection
  Subscribe  
newest oldest most voted
Notify of
Andy Rodriguez

Thank youuuuuuuuuuuuu it worked for me!

Vote Up0Vote Down  Reply
2 months ago
sree

It Worked but after using this solution my tomcat server is not working.

Vote Up0Vote Down  Reply
2 months ago
Henri

Thank so much! It worked!

Vote Up0Vote Down  Reply
7 months ago
Andy uwem

thank you so much it worked for me

Vote Up0Vote Down  Reply
8 months ago
Tanveer Ray

I tried this but did not work. do we have any other solution?

Vote Up0Vote Down  Reply
11 months ago
Shivam

Thank you. worked for me.

Vote Up0Vote Down  Reply
1 year ago
José Compadre Junior

Thanks for this tutorial. Saved my day!

Vote Up0Vote Down  Reply
1 year ago
sulabh

Thank you very much.

Vote Up0Vote Down  Reply
1 year ago
Pooja Lakkihal

thankyu so much man..

Vote Up0Vote Down  Reply
1 year ago
Deepak Maddeshiya

Thanks !

Vote Up0Vote Down  Reply
2 years ago
Prajakta

Thanks Lokesh………….

Vote Up0Vote Down  Reply
2 years ago
Doug

What is the difference between the two solutions?

Vote Up0Vote Down  Reply
2 years ago
Tarun Punjabi

Thanks a lot man !!!!

Vote Up0Vote Down  Reply
3 years ago
Milward Kadzitaye

Thanks man Solved my problem

Vote Up0Vote Down  Reply
3 years ago
Jyoti Gurjar

Thanks for Posting this solution. It worked for me.

Vote Up0Vote Down  Reply
3 years ago
Lokesh Kumar

27-Jan-2016 12:17:06.629 SEVERE [http-nio-8080-exec-13] org.apache.coyote.http11.AbstractHttp11Processor.process Error processing request
java.lang.IllegalStateException: The resources may not be accessed if they are not currently started
at org.apache.catalina.webresources.StandardRoot.validate(StandardRoot.java:232)
at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:199)
at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:193)
at org.apache.catalina.mapper.Mapper.internalMapWrapper(Mapper.java:918)
at org.apache.catalina.mapper.Mapper.internalMap(Mapper.java:808)
at org.apache.catalina.mapper.Mapper.map(Mapper.java:667)
at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:862)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

Vote Up0Vote Down  Reply
3 years ago
Lokesh Gupta

When you get this error?

Vote Up0Vote Down  Reply
3 years ago
Lokesh Kumar

After configure whole project in eclipse, i included >javax.servlet dependency. Then found the above error with code 500 on UI- Network.

Vote Up0Vote Down  Reply
3 years ago
samir

Great Man. Problem resolved.

Vote Up0Vote Down  Reply
3 years ago
Sanku

Thank you..its work for me

Vote Up0Vote Down  Reply
4 years ago
Marumo

Thanks for the solution to the problem “The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path in Eclipse”

Vote Up0Vote Down  Reply
4 years ago
Lokesh Gupta

Glad it was useful for you.

Vote Up0Vote Down  Reply
4 years ago

Search Tutorials

Eclipse Tutorials

  • Eclipse – Import Remote Archetype
  • Eclipse – Quick Search Plugin
  • Eclipse – Display Non-english Chars
  • Eclipse – Increase Console Limit
  • Eclipse – Create Code Templates
  • Eclipse – Make Faster
  • Compile Program in Other Language
  • Compiler Error When Hiding Final Static Methods
  • “javax.servlet.http.HttpServlet” not found

Popular Tutorials

  • Java 8 Tutorial
  • Core Java Tutorial
  • Collections in Java
  • Java Concurrency
  • Spring Boot Tutorial
  • Spring AOP Tutorial
  • Spring MVC Tutorial
  • Spring Security Tutorial
  • Hibernate Tutorial
  • Python Tutorial
  • Jersey Tutorial
  • Maven Tutorial
  • Log4j Tutorial
  • Regex Tutorial

Meta Links

  • Advertise
  • Contact Us
  • Privacy policy
  • About Me

Recommended Reading

  • 10 Life Lessons
  • Secure Hash Algorithms
  • How Web Servers work?
  • How Java I/O Works Internally?
  • Best Way to Learn Java
  • Java Best Practices Guide
  • Microservices Tutorial
  • REST API Tutorial
  • How to Start New Blog

Copyright © 2016 · HowToDoInjava.com · All Rights Reserved. | Sitemap

wpDiscuz