org.apache.jasper.JasperException: An exception occurred processing JSP page

| 阅读数:--次| 作者:小周
摘要:org.apache.jasper.JasperException: An exception occurred processing JSP page


HTTP Status 500 -


type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /edit2014/editsale.jsp at line 547

544: 					<input type="hidden" name="type" value="<%=recType%>">
545: 					<input type="hidden" name="pn" value="<%=pn%>">
546: 				<%
547: 				for(EditIndexSale node:blocks){
548: 					if(node.getSource()==35){
549: 						continue;
550: 					}


Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

java.lang.NullPointerException
	org.apache.jsp.edit2014.editsale_jsp._jspService(editsale_jsp.java:630)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.29 logs.


Apache Tomcat/6.0.29

解决办法:

org.apache.jasper.JasperException: An exception occurred processing JSP page /edit2014/editsale.jsp at line 547

看上面这行就知道出错在哪一行547这一行

547:for(EditIndexSale node:blocks){

547这行是一个for循环

root cause
java.lang.NullPointerException

再看root cause是一个空指针类型的

那就可以确定547这行的blocks集合为空,所以报空指针,修改代码让blocks不为空就不报错了

或是循环前加判断,为空不走循环


返回顶部
学到老代码浏览 关闭浏览