网络商店实例调试出现问题!!望各位大虾能指点迷津!
最近学习《精通Eclipse Web开发--Java体系结构、工具、架构及整合应用》书中的实例netshop时遇到调试问题,望各位大虾能指点迷津!
本实例的登陆和注册模块经过测试没有问题,问题出现在点击具体商品以浏览具体信息的时候,出现问题的页面如下:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "items " with value "${itemList.pageList} ": An error occurred while getting property "pageList " from an instance of class org.springframework.beans.support.PagedListHolder (java.lang.NullPointerException)
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:821)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.Jsp.Product_jsp._jspService(Product_jsp.java:262)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.netshop.util.CloseSessionFilter.doFilter(CloseSessionFilter.java:37)
com.netshop.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:91)
root cause
java.lang.NullPointerException
org.springframework.beans.support.PagedListHolder.getNrOfPages(PagedListHolder.java:194)
org.springframework.beans.support.PagedListHolder.getPage(PagedListHolder.java:169)
org.springframework.beans.support.PagedListHolder.getFirstElementOnPage(PagedListHolder.java:244)
org.springframework.beans.support.PagedListHolder.getPageList(PagedListHolder.java:260)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.taglibs.standard.lang.jstl.ArraySuffix.evaluate(ArraySuffix.java:278)
org.apache.taglibs.standard.lang.jstl.ComplexValue.evaluate(ComplexValue.java:107)
org.apache.taglibs.standard.lang.jstl.ELEvaluator.evaluate(ELEvaluator.java:204)
org.apache.taglibs.standard.lang.jstl.ELEvaluator.evaluate(ELEvaluator.java:163)
org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:101)
org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:129)
org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate(ExpressionEvaluatorManager.java:75)
org.apache.taglibs.standard.tag.el.core.ForEachTag.evaluateExpressions(ForEachTag.java:155)
org.apache.taglibs.standard.tag.el.core.ForEachTag.doStartTag(ForEachTag.java:66)
org.apache.jsp.Jsp.Product_jsp._jspx_meth_c_forEach_1(Product_jsp.java:853)
org.apache.jsp.Jsp.Product_jsp._jspService(Product_jsp.java:224)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.netshop.util.CloseSessionFilter.doFilter(CloseSessionFilter.java:37)
com.netshop.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:91)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
具体的实例完整源代码和问题描述可以在本网站的资源中下载:
http://download.csdn.net/source/180201
希望各位高手大虾能指点迷津!!谢谢!
联系邮箱:hzlzone@yahoo.com.cn QQ:362286206
[解决办法]
lz根据下面报的异常信息再仔细检查一下:
An error occurred while evaluating custom action attribute "items " with value "${itemList.pageList} ": An error occurred while getting property "pageList " from an instance of class
[解决办法]
又是空指针错误
检查下itemList.pageList
[解决办法]
根据exception信息查看对应代码, 空指针异常, 认真检查一下
[解决办法]
com.netshop.util.CloseSessionFilter.doFilter第37行有问题.
[解决办法]
chain看看是不是null
[解决办法]
在上面做一句System.out.prinltn(chain == null ? "NULL " : "NOT NULL " );
看看chain是不是null
[解决办法]
...这里没有对chain进行类型转换啊
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html