未找到 JSP 类:java.lang.ClassNotFoundException:org.apache.jsp.login_jsp

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30353571/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 16:59:11  来源:igfitidea点击:

JSP class not found: java.lang.ClassNotFoundException: org.apache.jsp.login_jsp

javajsp

提问by Tony Guo

When I start my Struts 2 Application, I got a 500 code. Here's the stack.

当我启动我的 Struts 2 应用程序时,我得到了一个 500 代码。这是堆栈。

org.apache.jasper.JasperException: java.lang.ClassNotFoundException: org.apache.jsp.login_jsp
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:176)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:368)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:96)

root cause

java.lang.ClassNotFoundException: org.apache.jsp.login_jsp
java.net.URLClassLoader.findClass(URLClassLoader.java:381)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:131)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:62)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:171)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:368)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:96)

采纳答案by gsl

The method getDispatcherType()(of class ServletRequest) was added to the Servlet API in version 3.0. So it seems that you are the Tomcat you are running is version 6.x or earlier which uses a Servlet API before 3.0, hence the method is unknown. Inside your IDE you apparently compile against the 3.0 version of the Servlet API.

该方法getDispatcherType()(类 ServletRequest)在 3.0 版中被添加到 Servlet API。因此,您运行的Tomcat似乎是6.x或更早版本,它使用3.0之前的Servlet API,因此方法未知。在您的 IDE 中,您显然是针对 3.0 版本的 Servlet API 进行编译的。

You must use Tomcat 7+ to use Servlet API 3.0 methods.

您必须使用 Tomcat 7+ 才能使用 Servlet API 3.0 方法。

回答by Raúl

Apparently, login.jsphas some compilation error. Try looking into that. Also, post the code here.

显然,login.jsp有一些编译错误。试着调查一下。另外,把代码贴在这里。

回答by Lokesh

<%@ include file="/WEB-INF/pco/Init.jsp"%>

<HTML>
<HEAD>
<TITLE>
NMTC Automation Summary
</TITLE>
</HEAD>
<BODY>
<center>
<H2>
Network Management Task Controller<br>
Administration Tool<br>
</H2>
<table>
<% if (userAuthorization.isPrincipalInRole((String)session.getAttribute("SecPTUserIDname_&"), "pco") ||
      userAuthorization.isPrincipalInRole((String)session.getAttribute("SecPTUserIDname_&"), "pcoview"))
   {
%>
<tr align="center"><td><a href="../pco/PCO.jsp?level=1">T1 PCO Automation</a></td></tr>
<%
   }
%>

<% if (userAuthorization.isPrincipalInRole((String)session.getAttribute("SecPTUserIDname_&"), "t3pco") ||
      userAuthorization.isPrincipalInRole((String)session.getAttribute("SecPTUserIDname_&"), "t3pcoview"))
   {
%>
<tr align="center"><td><a href="../t3pco/PCO.jsp?level=3">T3 PCO Automation</a></td></tr>
<% 
     }
%>

<% if (userAuthorization.isPrincipalInRole((String)session.getAttribute("SecPTUserIDname_&"), "nise"))
   {
%>
<tr align="center"><td><a href="../nise/NISE.jsp">NISE</a></td></tr>
<%
   }
%>

<tr><td>&nbsp;</td></tr>
<tr align="center"><td><a href="UserChangePasswd.jsp">Change Your Password</a></td></tr>

<% if (userAuthorization.isPrincipalInRole((String)session.getAttribute("SecPTUserIDname_&"), "admin"))
   {
%>
<tr align="center"><td><a href="../admin/PassAdmin.jsp">Administer User IDs</a></td></tr>
<tr align="center"><td><a href="../admin/PCORule.jsp">Administer PCO Automation Rule Table</a></td></tr>
<%
   }
%>

<tr><td>&nbsp;</td></tr>
<tr align="center"><td><a href="../login.jsp?LogOut=true"><b>Logoff</b></a></td></tr>
</table>
</center>
</BODY>
</HTML>