org.apache.jasper.JasperException:An exception occurred processing JSP page /Index.jsp at line 4037:%>38:39:43:Stacktrace:\x05org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)\x05org.apache.jasper.servlet.JspS

来源:学生作业帮助网 编辑:作业帮 时间:2024/12/01 10:04:02
org.apache.jasper.JasperException:An exception occurred processing JSP page /Index.jsp at line 4037:%>38:39:43:Stacktrace:\x05org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)\x05org.apache.jasper.servlet.JspS
xV[OG+R $k0 TmըЪE/ق^.}[6 ;܂PחgvfO =cZ"K+Ygf9;9~i !^Iѐz+H/ z9IYF9IxEc0'c5( ShB8^>QNW#vyFT*^Ӕ ? *R6Q%:3΋~M:.gO???|6za>Jw /AGWxp`y2@^AzZUUBfvxOѓ e ֏$ d&Uc6 AGBfPr r^~R8N"?hOHӽ*W jYۛn{V$dKg:K wIQ=l!3_ cyǙCz+ AB%y4rʺQ&Z(TWX4.vtㅲ1L%H*l5yU,]9slO;ZpQںƱʏa"Εȫ;5SuŠܱyf1<`.'\_4Qi\ AMw #3byb#s`wtg3˚Q5S(Rp0~K}$Y6ńQܳv<"e>mϽl뺸 "{eY={[Io`5ߔBУh@|M 39{Q`fkk3YXgU$LJd6`Z3'A)8]q*> uk8vz)T{qqdwPTT^ٖOaj3F)I:ɮ:ì>hg`Q xr?`)3zu%*_74>YAhL\Z8g6ơ?r=?7}ڼ5 :w""/KxY13j GH~'7lp\}A5/@ߥ-ibzn[k,NVpjD28vVoՂYC5|@ZqJD(t`_w$ g$h8?WSGOi13˨Kxq޽

org.apache.jasper.JasperException:An exception occurred processing JSP page /Index.jsp at line 4037:%>38:39:43:Stacktrace:\x05org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)\x05org.apache.jasper.servlet.JspS
org.apache.jasper.JasperException:An exception occurred processing JSP page /Index.jsp at line 40
37:%>
38:
39:
43:
Stacktrace:
\x05org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
\x05org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
\x05org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
\x05org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
\x05javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
\x05com.bjsxt.shopping.util.filter.IPFilter.doFilter(IPFilter.java:31)
root cause
java.lang.NullPointerException
\x05com.bjsxt.shopping.category.CategoryService.getCategories(CategoryService.java:102)
\x05org.apache.jsp.Index_jsp._jspService(Index_jsp.java:95)
\x05org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
\x05javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
\x05org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
\x05org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
\x05org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
\x05javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
\x05com.bjsxt.shopping.util.filter.IPFilter.doFilter(IPFilter.java:31)
如何改呢?

org.apache.jasper.JasperException:An exception occurred processing JSP page /Index.jsp at line 4037:%>38:39:43:Stacktrace:\x05org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)\x05org.apache.jasper.servlet.JspS
教你怎么看异常信息.你给出的信息里不是有一拖吗,先看Stacktrace部分
org.apache开头的,明显不是你的代码.apache的一个jar包.不用管.它报错是因为你传给它的值不是它想要的.javax.servlet.http.HttpServlet.service这个也不是你的代码.com.bjsxt.shopping.util.filter.IPFilter.doFilter这个相对来说可能就跟你的关系最经了.这应该是属于你们老师给的代码里的一部分.
接下来找错.
root cause 中的信息.先找com.bjsxt开头的.为什么,因为com.bjsxt离你最近
OK.你看到了两行最近的.我也看到两行:
com.bjsxt.shopping.category.CategoryService.getCategories(CategoryService.java:102)
com.bjsxt.shopping.util.filter.IPFilter.doFilter(IPFilter.java:31)
来.提示信息时NullPointerException;最熟悉的空指针.
从这两行中选.
然后看你问题题目中提到的:
org.apache.jasper.JasperException:An exception occurred processing JSP page /Index.jsp at line 40
注意,这个是最直观的信息 at line 40
好你又找到了line 40,是:
40:List categories = CategoryService.getInstance().getCategories();
看.跟我们之前揪出来的两行中的一行:
com.bjsxt.shopping.category.CategoryService.getCategories(CategoryService.java:102)
是不是关系最近对吧.
这个时候,你就可以很肯定的告诉自己告诉别人:
是你com.bjsxt.shopping.category包下的CategoryService类的 getCategories方法在你的第40行执行后,返回的结果是null,null当然就报nullpointException了.
你还可以看到
com.bjsxt.shopping.category.CategoryService.getCategories(CategoryService.java:102)
后面括号里的信息.那是提示你在执行getCategories方法时,代码运行到102行出的错.
大功告成.
讲的比你们老师将得还细.开个玩笑.