如题,
错误页面如下显示
error.jsp页面显示如下:(我新建一个jsp页面,却并不会出现上述图片的问题,很奇怪啊)
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
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
root cause
java.lang.NullPointerException
org.apache.jsp.Error_jsp._jspService(Error_jsp.java:42)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
note The full stack trace of the root cause is available in the Tomcat logs.
Apache Tomcat/5.0.16
tomcatlog 中的日志为 :
2016-08-12 06:35:29 StandardContext[/jsp-examples]ContextListener: contextInitialized()
2016-08-12 06:35:29 StandardContext[/jsp-examples]SessionListener: contextInitialized()
2016-08-12 06:35:29 StandardContext[/servlets-examples]ContextListener: contextInitialized()
2016-08-12 06:35:29 StandardContext[/servlets-examples]SessionListener: contextInitialized()
2016-08-12 06:36:12 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jsp.Error_jsp._jspService(Error_jsp.java:42)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:805)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:696)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
at java.lang.Thread.run(Unknown Source)
%>
ERROR.JSP
<%@ page
language = "java"
isErrorPage = "true"
contentType = "text/html; charset=gb2312"
%>
<html>
<head>
<title>错误信息</title>
</head>
<body bgcolor="#CCCCCC">
<center>
<p><font size="5"><b>错误信息</b></font></p>
<p> </p>
<p><font><%=exception.toString()%></font></p>
<p> </p>
<p><font><a href="javascript:history.back();">返回上一页</a></font></p>
<p> </p>
</center>
</body>
</html>
LOGIN.JSP
<%@ page
info = "用户登陆的 jsp"
errorPage = "Error.jsp"
contentType = "text/html; charset=gb2312"
import = "java.io.*"
import = "java.util.*"
import = "java.sql.*"
import = "qesuite.*"
%>
<%--实例化DBConnection对象dbConnection:建立连接池,预先建立三个数据库连接--%>
<jsp:useBean id="dbConnection" scope="application" class="qesuite.DBConnection" >
<jsp:setProperty name="dbConnection" property="poolSwitch" value="on" />
</jsp:useBean>
<%--实例化DBBridge对象dbBridge--%>
<jsp:useBean id="dbBridge" scope="page" class="qesuite.DBBridge" >
<jsp:setProperty name="dbBridge" property="dbConnection" value="<%=dbConnection%>" />
<jsp:setProperty name="dbBridge" property="bridgeSwitch" value="on" />
</jsp:useBean>
<%--实例化Project对象project--%>
<jsp:useBean id="project" scope="page" class="qesuite.Project" >
<jsp:setProperty name="project" property="dbBridge" value='<%=dbBridge%>' />
</jsp:useBean>
<%
if (!session.isNew ()) {
session.removeAttribute("id");
session.removeAttribute("password");
}
%>
<html>
<head>
<title>欢迎进入QESuite Web Version1.0系统</title>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META content="MSHTML 5.00.3700.6699" name=GENERATOR>
<link href="global/style.css" rel="stylesheet" type="text/css">
<script language="javascript">
<!--
function checkData()
{
with(document.loginForm)
{
if(id.value=="")
{
alert("请输入账号!");
return;
}
submit();
loginSCookie();
}
}
//-->
</script>
<script src="global/publicfun.js"></script>
<style type="text/css">
<!--
body {
background-color: #0C76B1;
}
.style1 {
color: #003884;
font-weight: bold;
}
-->
</style></head>
<body OnLoad="loginLCookie();">
<%--from gsh,to enable these codes Security Level of IE's must be down.--%>
<%-- <OBJECT classid="CLSID:2646205B-878C-11d1-B07C-0000C040BCDB" height="0" style=
"Display:None"
id="RemoveIEToolbar" width="1" codebase="NOIEToolbar.CAB" VIEWASTEXT>
<PARAM NAME="ToolBar" VALUE="0">
</OBJECT> --%>
<%--from gsh--%>
<P> </P>
<CENTER>
<%
//查询Project得到项目信息
project.loadData(0, 1);
%>
<form name="loginForm" action="loginProc.jsp" method="post" >
| ||||||||||||||||||||||||||||||||||||||||
</form>
</center>
</body>
</html>
<%
dbBridge.closeBridge ();
%>
Frère, exception nullpointer, postez le code de votre page jsp pour y jeter un œil
Il s'agit d'une erreur métier interne dans le code. . Cela ressemble à un pointeur nul. . Probablement 42 lignes après compilation
Recherchez le fichier Error_jsp.java dans le répertoire de travail Tomcat et un pointeur nul apparaît à la ligne 42.
Comme mentionné ci-dessus, le message d'erreur a déjà été affiché, vous devez toujours lire attentivement le message d'erreur