当前位置: 技术问答>java相关
请教一下:在运行jsp页,总是出现这个提示:(
来源: 互联网 发布时间:2015-05-09
本文导语: 请指点一下,谢谢~! A Servlet Exception Has Occurred Exception Report: javax.servlet.ServletException at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:481) at _0002fgrzc_0005fok_0002ejspgrzc_0005fok_jsp_0._jspService(_0002fgrzc_000...
请指点一下,谢谢~!
A Servlet Exception Has Occurred
Exception Report:
javax.servlet.ServletException
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:481)
at _0002fgrzc_0005fok_0002ejspgrzc_0005fok_jsp_0._jspService(_0002fgrzc_0005fok_0002ejspgrzc_0005fok_jsp_0.java:141)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:184)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:328)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:407)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:251)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:196)
at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:464)
at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:242)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2041)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:414)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:159)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:818)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:897)
at java.lang.Thread.run(Thread.java:536)
Root Cause:
java.lang.NullPointerException
at java.lang.reflect.Array.getLength(Native Method)
at _0002fgrzc_0005fok_0002ejspgrzc_0005fok_jsp_0._jspService(_0002fgrzc_0005fok_0002ejspgrzc_0005fok_jsp_0.java:116)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:184)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:328)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:407)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:251)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:196)
at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:464)
at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:242)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2041)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:414)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:159)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:818)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:897)
at java.lang.Thread.run(Thread.java:536)
A Servlet Exception Has Occurred
Exception Report:
javax.servlet.ServletException
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:481)
at _0002fgrzc_0005fok_0002ejspgrzc_0005fok_jsp_0._jspService(_0002fgrzc_0005fok_0002ejspgrzc_0005fok_jsp_0.java:141)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:184)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:328)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:407)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:251)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:196)
at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:464)
at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:242)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2041)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:414)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:159)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:818)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:897)
at java.lang.Thread.run(Thread.java:536)
Root Cause:
java.lang.NullPointerException
at java.lang.reflect.Array.getLength(Native Method)
at _0002fgrzc_0005fok_0002ejspgrzc_0005fok_jsp_0._jspService(_0002fgrzc_0005fok_0002ejspgrzc_0005fok_jsp_0.java:116)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:184)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:328)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:407)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:251)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:196)
at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:464)
at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:242)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2041)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:414)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:159)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:818)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:897)
at java.lang.Thread.run(Thread.java:536)
|
这里:if (request.getParameter("pages")==null || request.getParameter("pages").length() == 0) {
pages = 1;
} else {
pages = new Integer(request.getParameter("pages")).intValue();
}
其中:
request.getParameter("pages").length() == 0)
在最开始时
request.getParameter("pages")的值是null使用length()方法,会出现异常。
pages = 1;
} else {
pages = new Integer(request.getParameter("pages")).intValue();
}
其中:
request.getParameter("pages").length() == 0)
在最开始时
request.getParameter("pages")的值是null使用length()方法,会出现异常。
|
stupidball(小菜鸟) 说的这种情况应该不是,我测试过,这种情况不会发生空指针例外。因为它如果为null他将不会执行||后面的表达式。
贴出来的代码中我还没有发现会发生上面的错误,会不会是你
中的headeradv.jsp中的错误,这个文件好像与该页没有关系,是不是显示广告的一个页面,先去掉再试试~!
贴出来的代码中我还没有发现会发生上面的错误,会不会是你
中的headeradv.jsp中的错误,这个文件好像与该页没有关系,是不是显示广告的一个页面,先去掉再试试~!
|
把
if (request.getParameter("pages")==null || request.getParameter("pages").length() == 0)
改为
String pages=(String)request.getParameter("pages");
if(pages==null||pages.length()==0)
if (request.getParameter("pages")==null || request.getParameter("pages").length() == 0)
改为
String pages=(String)request.getParameter("pages");
if(pages==null||pages.length()==0)
|
好像少了}或者是{,仔细看一看。对了,你可以跟一下,或者每个一段设几个标志试一下,很容易发现哪一段出错的。
|
很显然是你程序中取数组长度时,数组为空引起的空指针错误。
你贴的此页源代码:贴错了
你贴的此页源代码:贴错了
|
因为空指针异常而引起的?
|
好象是数组越界了,看看你的代码里是不是有用到数组,仔细检查一下。