spring java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.pages.LandingPage_jsp
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25360722/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.pages.LandingPage_jsp
提问by abc32112
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?
到底发生了什么?
回答by Do Nhu Vy
Because:
因为:
Cause 1: Parsing JSP file error. For example: Error JSP page (due syntax error or missing dependencies):
原因 1:解析 JSP 文件错误。例如:错误 JSP 页面(由于语法错误或缺少依赖项):
<%@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:
原因 2:缺少依赖项。通过添加这些依赖项来修复它:
<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 scopelike the above.
你必须scope像上面那样设置。
回答by Greg
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.
就我而言,AOP 报告说我可以通过将 jar 添加到 catalina.properties 部分“tomcat.util.scan.StandardJarScanFilter.jarsToSkip”(包括 jstl-1.2.jar)来加快 tomcat 和 webapp 的启动时间。
Don't listen to this advice; only sadness will come of it.
不要听从这个建议;只有悲伤才会随之而来。
回答by Demon
I had this error:HTTP Status 500 - java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.views.index_jsp
我有这个错误: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!
在 index.jsp 中,我有一些内容:<%@include file="header.jsp"%>
但是文件的干净名称是 Header.jsp。仔细查看您的 LandingPage.jsp(第 2 行,第 0 列)。祝你好运!
回答by Manoj Shrestha
I also had the same issue once. It was resolved by changing the version of tomcat plugin from 2.0 to 2.2.
我也遇到过同样的问题。通过将 tomcat 插件的版本从 2.0 更改为 2.2 解决了这个问题。
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
回答by NoughT
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
在这里,您有一些无法编译的代码行。仔细查看你的代码。我还在我的 jsp 页面中放置了不必要的代码,例如
<spring:url value="/page.html">
Good luck!!
祝你好运!!
回答by Hema
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
经过大量工作后,我的问题是用于 tomcat 文件夹的脚本文件。如果将来有人需要同样的问题,我会分享这个
#!/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 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
回答by naXa
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.
就我而言,一个简单的应用程序重建重新部署帮助我解决了类似的异常。初始构建中似乎缺少一些资源(jsp?)。
回答by JJ Roman
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
在我的情况下,它是由 tomcat 将编译后的 jsps 放入 /tmp 引起的,然后被清除。这是报告的问题:https: //github.com/spring-projects/spring-boot/issues/5009
回答by Koraktor
This might also be caused by following hints that effectively disable JSP support in Tomcat 8+ to improve (startup) performance.
这也可能是由于遵循有效禁用 Tomcat 8+ 中的 JSP 支持以提高(启动)性能的提示。
Do notinclude JasperInitializerin the context's containerSciFilterproperty (in conf/context.xml).
不要不包括JasperInitializer在范围内的containerSciFilter属性(在conf/context.xml)。
回答by parsecer
In my case it was wrong filepaths to jsp:includepages, changed to this:
在我的情况下,jsp:include页面的文件路径错误,更改为:
<%@ include file = "/WEB-INF/views/shared/header.jsp" %>
For this project structure (inside a deployed war's folder in /webapps):
对于此项目结构(在 /webapps 中已部署的 war 文件夹中):
webapps
mywar
META-INF
resources
css
img
WEB-INF
classes
lib
views
login.jsp/etc
index.jsp

