Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.pages.LandingPage_jsp

I'm getting two very odd errors when opening a project. If I open the landing page and keep refreshing it, the error messages alternate between the two below.

Either I get this:

org.apache.jasper.JasperException: /WEB-INF/pages/LandingPage.jsp (line: 2, column: 0) The absolute uri: http://www.springframework.org/security/tags cannot be resolved in either web.xml or the jar files deployed with this application

Or this:

HTTP Status 500 - java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.pages.LandingPage_jsp

What on earth is happening?

like image 725
abc32112 Avatar asked Aug 18 '14 10:08

abc32112


2 Answers

Because:

Cause 1: Parsing JSP file error. For example: Error JSP page (due syntax error or missing dependencies):

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page session="false" %>
<html>
<head>
    <title>Home</title>
</head>
<body>
<h1>Hello world!</h1>
<p>The time on server is ${serverTime}.</p>
</body>
</html>

Make it correct:

<%@page session="false" %>
<html>
<head>
    <title>Home</title>
</head>
<body>
<h1>Hello world!</h1>
<p>The time on server is ${serverTime}.</p>
</body>
</html>

Cause 2: missing dependencies. Fix it by add these dependencies:

<dependency>
    <groupId>javax.servlet.jsp.jstl</groupId>
    <artifactId>jstl-api</artifactId>
    <version>1.2</version>
</dependency>
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>javax.servlet.jsp</groupId>
    <artifactId>jsp-api</artifactId>
    <version>2.2</version>
    <scope>provided</scope>
</dependency>

You must set scope like the above.

like image 71
Do Nhu Vy Avatar answered Sep 22 '22 15:09

Do Nhu Vy


In my case, AOP was reporting that I could speed up tomcat and webapp start time by adding jars to the catalina.properties section "tomcat.util.scan.StandardJarScanFilter.jarsToSkip", including jstl-1.2.jar.

Don't listen to this advice; only sadness will come of it.

like image 36
Greg Avatar answered Sep 19 '22 15:09

Greg