我在生产服务器上部署了我的项目,并得到以下错误。
这是一个实时项目,所以,在出现错误后,我用运行良好的前一个版本替换了它,但现在它也抛出了相同的错误。请告诉我有什么问题?
错误:
HTTP Status 500 - org.apache.jasper.JasperException: java.lang.NullPointerException
--------------------------------------------------------------------------------
type Exception report
message org.apache.jasper.JasperException: java.lang.NullPointerException
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:412)
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
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
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)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:709)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:680)
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:821)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
org.apache.jsp.LPSSuppIndex_jsp._jspService(LPSSuppIndex_jsp.java:393)
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:388)
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.error_jsp._jspService(error_jsp.java:124)
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:388)
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)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:709)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:680)
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:821)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
org.apache.jsp.LPSSuppIndex_jsp._jspService(LPSSuppIndex_jsp.java:393)
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:388)
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.36 logs.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.36
InExpage。jsp:
<%@ page errorPage="error.jsp"%>
<%@ page import="java.util.*" %>
<%@ page import = "jdbc.RetrieveLangList,lang.MessageGetter" %>
<%!
HashMap<String, String> langListMap = new HashMap<String, String>();
%>
<%
//Retrieving language MAP
RetrieveLangList objList = new RetrieveLangList();
langListMap = objList.LangList();
Set s = langListMap.entrySet(); // Get hashmap in Set interface to get key and value
Iterator it = s.iterator(); // Move next key and value of HashMap by iterator
String suppLang = "en_US";
suppLang = request.getParameter("suppLanguage");
if (suppLang == null || suppLang.equalsIgnoreCase(""))
suppLang = "en_US";
%>
<html>
<HEAD>
<TITLE> Welcome to </TITLE>
<link rel="SHORTCUT ICON" href="image/H.ico"/>
<LINK href="image/css/Rcontent.css" type="text/css" rel="stylesheet">
</HEAD>
<script language="JavaScript">
function loadPage(list)
{
location.href=list.options[list.selectedIndex].value;
}
</script>
<SCRIPT language="Javascript">
function ValidateForm()
{
//Supplier Number Validation
var supp_number =document.loginForm.uname;
if((supp_number.value=="su")||(supp_number.value=="SU"))
{
return true;
}
var stripped = supp_number.value.replace(/[\(\)\.\-\ ]/g, '');
if((supp_number.value==null)||(supp_number.value==""))
{
alert("<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "Enter_User_ID")%>");
supp_number.focus();
return false;
}
else if (isNaN(parseInt(stripped))) {
alert("<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "Invalid_User_ID")%>");
supp_number.focus();
return false;
}
//Password Validation
var supp_pass =document.loginForm.pass;
if((supp_pass.value==null)||(supp_pass.value==""))
{
alert("<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "Enter_Password")%>");
//alert("Please Enter Password");
supp_pass.focus();
return false;
}
return true;
}
</SCRIPT>
<BODY bgcolor="#C7CACF">
<center>
<table border = "0" bordercolor = "black" style="background-image:url('image/backgroundIndex.jpg');background-repeat:no-repeat" width="1000" HEIGHT = "700" >
<tr height = "60">
<td> </td>
<td> </td>
<td colspan="2">
<form name="form1" >
<TABLE border="0" width = "610">
<TR>
<td width="300" align="right" height="40">
<select name="file" size="1" onchange="loadPage(this.form.elements[0])" target="_parent._top" onmouseclick="this.focus()" style="background-color: #ffffff;width:150px;"> <!-- This is language selection box -->
<%
while (it.hasNext())
{
Map.Entry m = (Map.Entry) it.next(); // key=value separator this by Map.Entry to get key and value
//System.out.println("value : "+m.getValue()+" key : "+m.getKey());
if(suppLang.equals(m.getKey()))
{
%>
<option value="LPSSuppIndex.jsp?suppLanguage=<%= m.getKey()%>" selected="selected"><%= m.getValue()%></option>
<%
}
else
{
%>
<option value="LPSSuppIndex.jsp?suppLanguage=<%= m.getKey()%>"><%= m.getValue()%></option>
<%
}
}
%>
</select>
</td>
<td width = "300px" align="right"><a HREF="mailto:?subject=<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "sub_contact")%>&body=<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "body_line1_contact")%>, %0D%0D%0D<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "body_line2_contact")%>, %0D%0D%0D<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "body_line3_contact")%>%0D%0D%0D"><font color="#73767B" size="2"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "contact")%></font></a><font color="#73767B"><B> |</B></font><a href="http://www..com/en/service/imprint-legal-issues.html"><font color="#73767B" size="2"> <%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "imprint_legel_issue")%></font></a><font color="#73767B"><B> | </B></font><a href="http://www..com/en/service/sitemap.html"><font color="#73767B" size="2"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "sitemap")%></font></a></td>
</TR>
<TR height="12px">
<TD colspan="2"> </TD>
</TR>
</TABLE>
</form>
</td>
</tr>
<tr>
<td height = "240px" valign="top">
<TABLE border="0" width = "195">
<TR>
<TD height="40" width="155" align="left"><div style="position:relative;left: 20px;"><a href="LPSSuppIndex.jsp"><font color="#73767B" size="3"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "home")%></font></a></div></TD>
</TR>
<TR>
<TD height="37" align="left"><div style="position:relative;left: 20px;"><A HREF="mailto:er_Admin@de..com?subject=<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "sub_contact")%>&body=<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "body_line1_contact")%>, %0D%0D%0D<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "body_line2_contact")%>, %0D%0D%0D<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "body_line3_contact")%>%0D%0D%0D"><font color="#73767B"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "contact")%></font></a></div></TD>
</TR>
<TR>
<TD height="35" align="left"><div style="position:relative;left: 20px;"><a href="LPSSuppIndex.jsp"><font color="#73767B" size="3"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "log_in")%></font></a></div></TD>
</TR>
<TR>
<TD height="34" align="left"> <a href="http://wwwcom"><font color="white" style="font-family:Arial, Helvetica, sans-serif;font-size: 10pt; font-weight: bold"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "tportal")%></font></a></TD>
</TR>
<TR>
<TD height = "32" align="center"> </TD>
</TR>
<TR>
<TD height = "43px" colspan="2" align="center"> </TD>
</TR>
</TABLE>
</td>
<td colspan="2"> </td>
<td rowspan="3" valign="top">
<table border="0px" >
<tr height="139px"><td> </td><td> </td></tr>
<tr height="431px">
<td valign="top" width="8px"><div class="vertical-line" style="position:relative;left:27px;top:0px;"></div></td>
<td valign="top">
<!-- START RIGHT CONTENT -->
<DIV class="cntr_cnt_gradbox" style="position: relative;left: 15px;top: -5px;">
<DIV class="cntr_head"><font size="2%"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "PDF_download")%> </font></DIV>
<DIV class="cntr_cnt_gradbox_inner">
<DIV class="cntr_frame" style="height: 60px;">
<DIV style="FLOAT: left;height: 50px;" >
<IMG src="image/PDF_Thumbnail_50x50.gif" border="0">
</DIV>
<DIV class="cntr_dl_cnt" style="MARGIN-LEFT: 55px;">
<A class="cntr_lnk" href="PDF/User Maner_EN.pdf" target="_blank"><font color="#73767B" size="2%"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "manual_en")%></font></A>
</DIV>
<BR class="clr">
</DIV>
<BR class="clr">
<DIV class="cntr_frame" style="height: 60px;">
<DIV style="FLOAT: left;height: 50px;" >
<IMG src="image/PDF_Thumbnail_50x50.gif" border="0">
</DIV>
<DIV class="cntr_dl_cnt" style="MARGIN-LEFT: 55px;">
<A class="cntr_lnk" href="PDF/Benutzerhl Printer_DE.pdf" target="_blank"><font color="#73767B" size="2%"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "manual_de")%></font></A>
</DIV>
<BR class="clr">
</DIV>
<BR class="clr">
<DIV class="cntr_frame" style="height: 60px;">
<DIV style="FLOAT: left;height: 50px;" >
<IMG src="image/PDF_Thumbnail_50x50.gif" border="0">
</DIV>
<DIV class="cntr_dl_cnt" style="MARGIN-LEFT: 55px;">
<A class="cntr_lnk" href="PDF/Print_Specification.pdf" target="_blank" title="<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "printHelp_tip")%>"><font color="#73767B" size="2%"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "printHelp")%></font></A>
</DIV>
<BR class="clr">
</DIV>
<DIV class="cntr_frame1" style="height: 30px;">
<div style="margin-left: 30px;"> <A class="cntr_lnk" href="PDF/quick_guide_en.pdf" target="_blank"><font color="#73767B" size="2%"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "one_point_lessons")%> - EN</font></A></div>
</DIV>
<DIV class="cntr_frame1" style="height: 30px;">
<div style="margin-left: 30px;"> <A class="cntr_lnk" href="PDF/quick_guide_de.pdf" target="_blank"><font color="#73767B" size="2%"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "one_point_lessons")%> - DE</font></A></div>
</DIV>
<DIV style="height: 30px;vertical-align: middle;">
<div style="margin-left: 30px;"> <A class="cntr_lnk" href="PDF/FAQ.pdf" target="_blank"><font color="#73767B" size="2%">FAQ</font></A></div>
</DIV>
</DIV>
</DIV>
</td>
</tr>
</table>
</td>
</tr>
<tr height = "210">
<td> </td>
<td> </td>
<td>
<form method="post" name="loginForm" action="./loginServlet" onsubmit="return ValidateForm()">
<input type="hidden" name="selectedLang" value="<%=suppLang%>" >
<TABLE border="0" bordercolor="black" width="370">
<tr><td rowspan="6" width = "30"> </td></tr>
<TR height="45">
<td width="110" ><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "user_id")%> : </td><!-- This is Supplier Number(User ID) entry field. -->
<td width="230" align="center"><input type="text" size="25" name="uname" style="border-color: #529DFA;" maxlength="10"></td>
</TR>
<TR>
<td height="45"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "Password")%> : </td><!-- This is Password entry field. -->
<td align="center"><input type="password" size="25" name="pass" style="border-color: #529DFA;"></td>
</TR>
<TR height="40">
<td> </td>
<td align ="center" height="40"><A HREF="mailto_Printer_Admin@de.h.com?subject=<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "sub_forget_password")%>&body=<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "body_line1_forget_password")%>, %0D%0D%0D<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "body_line2_forget_password")%>%0D%0D%0D"><%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "forget_password")%></A>
</td>
</TR>
<TR>
<td height="40" align="right"><input type="Submit" value="<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "log_in")%>" /> </td>
<td align="center"><input type="button" onClick="location.href='register/suppRegistration.jsp?selectedLang=<%=suppLang%>'" value="<%=MessageGetter.getMessage("lang.MessagesBundle", suppLang, "new_user")%>" /></td>
</TR>
</TABLE></form>
</td>
</tr>
<tr height = "114">
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td width = "200"> </td>
<td width="170"> </td>
<td width="380"> </td>
<td width="230" align="center"> </td>
</tr>
</table>
</center>
</BODY>
</HTML>
在以下情况下,JSP也可能发生NullPointerException:
getter返回一个非公共内部类。
如果删除Getters的访问修饰符或将其设置为私有或受保护,则此代码将失败。
爪哇:
package com.myPackage;
public class MyClass{
//: Must be public or you will get:
//: org.apache.jasper.JasperException:
//: java.lang.NullPointerException
public class Getters{
public String
myProperty(){ return(my_property); }
};;
//: JSP EL can only access functions:
private Getters _get;
public Getters get(){ return _get; }
private String
my_property;
public MyClass(String my_property){
super();
this.my_property = my_property;
_get = new Getters();
};;
};;
JSP
<%@ taglib uri ="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page import="com.myPackage.MyClass" %>
<%
MyClass inst = new MyClass("[PROP_VALUE]");
pageContext.setAttribute("my_inst", inst );
%><html lang="en"><body>
${ my_inst.get().myProperty() }
</body></html>
在Tomcat a中。java和。将为应用程序中的每个jsp文件创建类文件,并且可以从下面的路径中找到相同的文件,Apache Tomcat\work\Catalina\localhost\ApplicationName'\org\Apache\jsp\index\u jsp。java
在您的情况下,jsp名称是error.jsp因此路径应该类似于下面的Apache-Tomcat\work\Catalina\localhost\'Application ationName'\org\apache\jsp\error_jsp.java
在第124行中,您尝试访问导致空指针异常的空对象。
我的jsp有一个代码: 这是我的servlet: 当我点击登录按钮时,我有一个错误。 提前谢谢
我正在尝试从servlet(viewcurrentstock.java)检索一个属性到jsp(viewstock.jsp)。这里有一个例外提示:“org.apache.jasper.JasperException:java.lang.NullPointerException” 查看当前股票。JAVA viewstock.jsp 服务器日志:
我为在线DVD商店创建了一个EJB应用程序。我使用Netbean 7.2.1和Glassfish 3.1.2当我运行index.jsp时,它的界面启动成功,如果我单击表单提交按钮,我会收到此错误: 在Netbean中,我得到了这个错误: 我创建了一个JavaEE企业应用程序。我有项目ejb和项目战争。因为我无法直接从ejb创建SessionBean,所以我创建了一个新的项目/Java库类,并在那里
在我的jsp页面中,有一些纯java代码,即scriptlet。经过很长一段时间的刷新后,它就会抛出 有时不长时间也会抛出同样的异常。JSP页面显示的是空页面。因此,用户只有一个选择是注销。为了避免这种情况,把他重定向到错误页面。怎么做?
在我部署在WebSphere 8.5上的java应用程序中,我遇到了这个错误,尽管我的maven依赖项低于log4j。 我确实运行了一个,我可以看到它正以 的形式被拉进来,这是我期望在树结果中看到的,这样我就可以确认它在类路径中。有什么想法吗?
Apache Kafka:分布式消息传递系统 Apache Storm:实时消息处理 我们如何在实时数据管道中使用这两种技术来处理事件数据? 在实时数据管道方面,我觉得两者做的工作是一样的。如何在数据管道上同时使用这两种技术?