aspose file tools*
The moose likes Servlets and the fly likes http error? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "http error?" Watch "http error?" New topic
Author

http 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

javax.servlet.ServletException: Wrapper cannot find servlet class Person or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:619)


root cause

java.lang.ClassNotFoundException: Person
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:619)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
===============================================================================================




person.jsp [size=24] [/size]
<%@ 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>Personnel Details</title>
</head>
<body>
<center>
<form action="/person/person" method="post">

Name:<input value="name"><br>
Father name:<input vaue="fname"><br>
Mobile No:<input values="mno"><br>
Company:<input values="comp"><br>
Address:<textarea values="add" type="addres"></textarea><br>


City:
<select name="City">
<option value="Bangalore">Bangalore</option>
<option value="Chennai">Chennai</option>
<option value="Hyderbad">Hyderbad</option>
<option value="Mumbai">Mumbai</option>
</select>
<br>

States:
<select name="States">
<option value="Kanataka">Kanataka</option>
<option value="Tamilnadu">Tamilnadu</option>
<option value="Andrapradesh">Andrapradesh</option>
<option value="Maharastra">Maharastra</option>
</select><br>

<input type=submit name="b1" value="Save">
<input type=submit name="b1" value="Edit"> <br>
</form>
</center>
</body>

</html>
==========================================================================================================

[color=red] person.java [size=24] [/color][/size]


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
{
String paramName = null;

Map<String, String[]> personalDetailsMap=null;
HttpSession session=request.getSession();
Enumeration<String> param = request.getParameterNames();

while(param.hasMoreElements())
{
personalDetailsMap = new HashMap<String, String[]>();
paramName = param.nextElement();
String[] paramValues = request.getParameterValues(paramName);
/* for(int i=0; i<paramValues.length; i++){
String paramName = paramValues.

}*/
personalDetailsMap.put("personalDetailsMap", paramValues);



}
session.setAttribute("paramlist",personalDetailsMap);
String btnVal=request.getParameter("b1");
if("Save".equals(btnVal))
{

RequestDispatcher dispatcher=request.getRequestDispatcher("/jsp/save.jsp");
dispatcher.forward(request,response);
}
else if("Edit".equals(btnVal))
{
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);
}
}



===========================================================================================================


[color=red]ouput.jsp[/color][size=24] [/size]
<%@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>


<%
out.println(request.getAttribute("paramlist")); %>
<%
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>

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

This line says it all:

java.lang.ClassNotFoundException: Person


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18150
    
    8

I wonder whether that message means the Person class is really not in the web application's classpath, or whether it actually means that the Person class is not in a package, as it must be to be loaded by a class which is in a package?
karthik ekantha
Ranch Hand

Joined: Feb 08, 2012
Posts: 78
now i took some changes .then now i 'm got error in output.jsp.when edit button click.please check my output.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: 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:51)
Person.doPost(Person.java:57)
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:78)
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:51)
Person.doPost(Person.java:57)
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.

===================================================================
output.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>


<%
out.println(request.getAttribute("paramlist")); %>
<%
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>
Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 166

Seems the following lines causing the problem,


Try to print the above statements line by line or check the below error in compiled output.jsp file under (if tomcat) Tomcat/work/Catalina/localhost/[my-web-app]/org/apache/jsp

org.apache.jsp.jsp.output_jsp._jspService(output_jsp.java:78)


No pain, No gain.
OCJP 1.6
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: http error?
 
Similar Threads
please any one cleare my error
Need help in JSP/Servlets
I got http-500 error in servlet and jsp.how to find error?
Dropdown values not submitted
Data truncation: Truncated incorrect DOUBLE value: