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

我的未来我决定 提交于 2020-01-02 00:57:50

问题


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?


回答1:


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.




回答2:


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.




回答3:


I had this error:
HTTP Status 500 - java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.views.index_jsp

In index.jsp i have some line:
<%@include file="header.jsp"%>
But clean name of file was Header.jsp. Look at your LandingPage.jsp (line: 2, column: 0) closely. Good luck!




回答4:


I also had the same issue once. It was resolved by changing the version of tomcat plugin from 2.0 to 2.2.

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
</plugin>



回答5:


In here you have some code line that can't be complied. Look your code carefully. I also put unnecessary code in my jsp page like

<spring:url value="/page.html">

Good luck!!




回答6:


I had the same issue when deployed into remote server.But my project was working fine in local server.

After a lot of work around ,my issue was with script file used for tomcat folder. Am sharing this if incase anyone needs in future with same kind of issue

#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=/opt/jdk1.8.0_60
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
export TOMCAT_HOME=/usr/tomcat7
export JEE_JAR=$JAVA_HOME
export JRE_HOME=$JAVA_HOME
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
CATALINA_HOME=/usr/tomcat7

case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0



回答7:


In my case a simple application rebuild-redeploy helped me to solve the similar exception. It seems like some resources (jsp ?) were missing in the initial build.




回答8:


In my case it was caused by tomcat putting compiled jsps into /tmp which then got cleared. This is reported issue: https://github.com/spring-projects/spring-boot/issues/5009




回答9:


This might also be caused by following hints that effectively disable JSP support in Tomcat 8+ to improve (startup) performance.

Do not include JasperInitializer in the context’s containerSciFilter property (in conf/context.xml).



来源:https://stackoverflow.com/questions/25360722/java-lang-classnotfoundexception-org-apache-jsp-web-002dinf-pages-landingpage-j

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!