File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes I got http-500 error in servlet and  jsp.how to find error? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "I got http-500 error in servlet and  jsp.how to find error?" Watch "I got http-500 error in servlet and  jsp.how to find error?" New topic
Author

I got http-500 error in servlet and jsp.how to find error?

karthik ekantha
Ranch Hand

Joined: Feb 08, 2012
Posts: 78
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: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
person.doGet(person.java:42)
person.doPost(person.java:49)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

java.lang.NullPointerException
org.apache.jsp.jsp.output_jsp._jspService(output_jsp.java:73)
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:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
person.doGet(person.java:42)
person.doPost(person.java:49)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
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.18 logs.

karthik ekantha
Ranch Hand

Joined: Feb 08, 2012
Posts: 78
this is my servlet program.....this is contain person details get from 1st jsp file and display to another jsp file



import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;


public class person extends HttpServlet {

public void doGet (HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException
{
int i=0;
String paramName = null;


HttpSession session=request.getSession();
Enumeration<String> param = request.getParameterNames();

while(param.hasMoreElements())
{
paramName = param.nextElement();
String[] paramValues = request.getParameterValues(paramName);



}
session.setAttribute("paramlist",paramName );



RequestDispatcher dispatch=request.getRequestDispatcher("/jsp/output.jsp");
if ( null != dispatch ) {
dispatch.forward(request,response);
}


}
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
karthik ekantha
Ranch Hand

Joined: Feb 08, 2012
Posts: 78
this type of error ll come .how to idetify and solve this error .please help me any one
karthik ekantha
Ranch Hand

Joined: Feb 08, 2012
Posts: 78
this is ouput .jsp





<%@page import="java.util.List"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Map"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Output.jsp</title>
</head>
<body>

this is another output.jsp page
<%
List paramlist=(List)request.getAttribute("paramlist");

Iterator itr =paramlist.iterator();
for (itr=paramlist.iterator(); itr.hasNext(); )
{
%>
<tr>
<td ><%=itr.next()%></td>
<td ><%=itr.next()%></td>
</tr>
<%}%>

</body>
</html>
adeeb alexander
Ranch Hand

Joined: May 29, 2008
Posts: 268
Please use the code tag to add your code to post.
Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 166

Can you add print statements before this line, I suspect the list reference paramlist would be null. Also have a check for null and if not then go with iteration on it.



No pain, No gain.
OCJP 1.6
karthik ekantha
Ranch Hand

Joined: Feb 08, 2012
Posts: 78
i can change add the print statement...now following error came now ..

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: An exception occurred processing JSP page /jsp/output.jsp at line 19

16: out.println(request.getAttribute("paramlist"));
17: List paramlist=(List)request.getAttribute("paramlist");
18:
19: Iterator itr =paramlist.iterator();
20: for (itr=paramlist.iterator(); itr.hasNext(); )
21: {
22: %>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
person.doGet(person.java:42)
person.doPost(person.java:49)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

java.lang.NullPointerException
org.apache.jsp.jsp.output_jsp._jspService(output_jsp.java:74)
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:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
person.doGet(person.java:42)
person.doPost(person.java:49)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
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.18 logs.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.18

karthik ekantha
Ranch Hand

Joined: Feb 08, 2012
Posts: 78
thank you for your response.need possible this solve this problem
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: I got http-500 error in servlet and jsp.how to find error?
 
Similar Threads
how to solve the error
Doubt in JSP Custom tags (Simple Tag) in Dynamic Drop Down
Module 'null' not found
Error JSP - Tomcat
Getting error while running BeerStruts example