• Register
Welcome to Kodlogs, programming questions and answer website.
+1 vote
10 views

Problem:

I am having following issue I am always getting this error:

the superclass "javax.servlet.http.httpservlet" was not found on the java build path.

I am getting this error on JSP page while using maven integration with eclipse.

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

by (300 points)  
reopened by

1 Answer

+1 vote

Possible Cause:

The reason of this error may be because you are missing dependency of javax.servlet-api  into you project pom.xml

Solution: 

Method1: UseTarget Runtime

In this method add server runtime to your application like for facet.

Properties > Select Project Facets >  SelectRuntimes > Choose Server name > Click Apply > Click OK

Method 2: Maven Dependency

In this method you can include the servlet dependency via maven. 

<dependency>

    <groupId>javax.servlet</groupId>

    <artifactId>servlet-api</artifactId>

    <version>3.1.0</version>

</dependency>

Method 3: Use Runtime and add to the classpath

Java Build Path > Libraries > Add Library > Server Runtime > Next 

then select a Runtime(Apache Tomcat Server) > Finish > OK 

Conclusion:

The above methods will sort out issue with superclass "javax.servlet.http.httpservlet" was not found on the java build path

Further Reading Suggested/ See more Links/ Userful Resource:

https://stackoverflow.com/questions/45768400/javax-servlet-http-httpservlet-was-not-found

https://howtodoinjava.com/eclipse/solved-the-superclass-javax-servlet-http-httpservlet-was-not-found-on-the-java-build-path-in-eclipse/

https://stackoverflow.com/questions/39004463/the-superclass-javax-servlet-http-httpservlet-was-not-found-on-the-java-build

by (1.4k points)  
...