Tutorials / Tech blog / Geek Zone

Latest Posts

Monday, October 10, 2016

Superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path

One might encounter this error against default index.jsp file (i.e. Welcome JSP) while creating maven project via Eclipse.

Following are the possible ways of fixing the above problem.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>

Update Maven Project (ALT+F5) should resolve this issue. However do note that this is not a recommended solution. On deployed to a different servletcontainer this might lead to future compatibility, portability issues.
  • Add Targeted Runtimes for your project.
                Method 1
    • Select Project and navigate to properties of your project (i.e. Right-Click or ALT  + ENTER)
    • Select the Targeted Run-time option available.

                Method 2
    • Select Project and navigate to properties of your project (i.e. Right-Click or ALT  + ENTER)
    • Select JAVA Build Path.(Option available :: Left Nav)
    • Select Add Library (Option available :: Right Nav)
    • Select option "Server Runtime" (Press Next)
    • Select a runtime to be added to class-path

                Method 3
    • Select Project and navigate to properties of your project (i.e. Right-Click or ALT  + ENTER)
    • Select Project Facets (Option available :: Left Nav)
    • Select Runtime TAB (Option available :: Right Nav)
    • Select the Targeted Run-time option available.

















1 comment: