ServletException in '/left.do': java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.tiles.leftlogged_jsp

旧时模样 提交于 2019-12-22 11:34:06

问题


After integrating ESAPI into a login form I am getting a rendering issue and an error after a successful login.

The error generated in the browser states:

   javax.servlet.ServletException: org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: ServletException in '/left.do': java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.tiles.leftlogged_jsp

And the server's debug log states the following:

SEVERE: Servlet.service() for servlet [ActionServlet] in context with path [/FIXED] 
threw exception [javax.servlet.ServletException: org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: ServletException in '/left.do': java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.tiles.leftlogged_jsp] with root cause
java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.tiles.leftlogged_jsp

The weird thing is, I haven't even touched any jsp pages when integrating esapi, and it worked before hand. I've only modified a couple java pages yet I get this now after a successful login.

There is more to both error messages I can include if it will be helpful. Since I haven't modified the leftlogged.jsp, yet it is the one giving the problems I thought I'd include it as well as it may be helpful.

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
Welcome ${USERNAME}!<br />
<logic:messagesPresent message="false">
  <html:messages id="msg">
    <span class="error"><bean:write name="msg" /></span><br />
  </html:messages>
</logic:messagesPresent>
<logic:messagesPresent message="true">
  <html:messages id="msg" message="true">
    <strong><bean:write name="msg" /></strong><br />
  </html:messages>
</logic:messagesPresent>
Your account balance is <fmt:formatNumber pattern="\$#,##0.00" value="${BALANCE}" />
<br />
<br />
Add Balance:<br />
<html:form method="POST" action="/addbalance">
<table border="0" width="100%">
<tr>
<td class="prompt">Type:</td>
<td class="ui"><html:select property="vendor">
<html:option value="">-- SELECT</html:option>
<html:option value="VISA">VISA</html:option>
<html:option value="MASTERCARD">MASTERCARD</html:option>
</html:select>
</td>
</tr>
<tr>
  <td class="prompt">Number:</td>
  <td class="ui"><html:password property="cc" /></td>
</tr>
<tr>
  <td class="prompt">Amount:</td>
  <td class="ui"><html:text property="amount" /></td>
</tr>
<tr>
  <td colspan="2" class="ui" style="text-align: center"><input type="submit" value="Add" /></td>
</tr>
</table>
</html:form>
<br />
<br />
<a href="<c:url value="/friends.do" />">Friends</a><br />
<a href="<c:url value="/profile.do" />">Profile</a><br />
<a href="<c:url value="/index.jsp" />">CD's</a>
<br />
<br />
<a href="<c:url value="/logout.do" />">Log Out</a>

Could someone explain to me what exactly Eclipse is not liking because of right now I'm not sure what I should check out?

UPDATE: I removed everything except the Welcome and taglibs from the code so that the leftlogged.jsp looks as follows:

Welcome ${USERNAME}!<br />

The error message continues and didn't change any.

Any further thoughts on what that could possibly mean is wrong?


回答1:


I had a same problem (ClassNotFound ... WEB_002dINF ...) I fix it by deleting

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jsp-api</artifactId>
    <version>2.0</version>
</dependency>

from my pom.xml




回答2:


Alternatively, if removing javax.servlet breaks your app and you're inheriting it from another source (a common project that your team puts shared resources in, for example), try adding

<scope>provided</scope> 

in the dependency tag for javax.servlet.



来源:https://stackoverflow.com/questions/8205069/servletexception-in-left-do-java-lang-classnotfoundexception-org-apache-jsp

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