1. Problem
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 classpath and you must include it.
The error looks like this.
2. Solution
To include http-servlet into your classpath, you have two options.
1. Add Target Server Runtime
In this solution, you can add desired server runtime into your application as a project facet. As runtime servers have already servlet runtime dependencies, they get included in your project and hence the error is gone.
2. Add Maven Dependency
Another option is to include the latest version of javax.servlet-api dependency from Maven repository. This will also fix the error.
Do not forget to run mvn update
command after including the dependencies.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
If you are using Jakarta servlet API, then you should be using the latest version of jakarta.servlet-api.
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
Happy Learning !!
After that don’t forget to perform two operations: Maven update and maven install.
Worked like charm ;)
Thank youuuuuuuuuuuuu it worked for me!
It Worked but after using this solution my tomcat server is not working.
Thank so much! It worked!
thank you so much it worked for me
I tried this but did not work. do we have any other solution?
Thank you. worked for me.
Thanks for this tutorial. Saved my day!
Thank you very much.
thankyu so much man..
Thanks !
Thanks Lokesh………….
What is the difference between the two solutions?
Thanks a lot man !!!!
Thanks man Solved my problem
Thanks for Posting this solution. It worked for me.
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)
When you get this error?
After configure whole project in eclipse, i included >javax.servlet dependency. Then found the above error with code 500 on UI- Network.
Great Man. Problem resolved.
Thanks for the solution to the problem “The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path in Eclipse”
Glad it was useful for you.