aspose file tools*
The moose likes Servlets and the fly likes HTTP Status 500 - error running servlet with JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP Status 500 - error running servlet with JSP" Watch "HTTP Status 500 - error running servlet with JSP" New topic
Author

HTTP Status 500 - error running servlet with JSP

Chandan Ghosh
Greenhorn

Joined: Jan 17, 2008
Posts: 2
I'm attempting to run the program from chapter 3 of Head First Servlets & JSP, and I get the following error.I am using apache-tomcat-5.5.17, jdk1.6.0, jre1.6.0



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.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.example.web.BeerSelect.doPost(BeerSelect.java:34)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NullPointerException
org.apache.jsp.result_jsp._jspService(result_jsp.java:51)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.example.web.BeerSelect.doPost(BeerSelect.java:34)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


my servlet and jsp codes are like this:

result.jsp:
-----------


BeerSelect.jsp:
---------------


please someone help me debug this problem.



[BSouther: Added UBB CODE tags]
[ February 03, 2008: Message edited by: Ben Souther ]
Tom Katz
Ranch Hand

Joined: Aug 19, 2002
Posts: 169
Without seeing the BeerExpert code, or what line is throwing the NPE in the .jsp, my best guess is that there is a null List being returned so the JSP throws the null pointer exception.

I would debug/print-out the contents of that List before you set it as a request attribute.

Tom
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410



You're setting an attribute named "sytles" but looking for an attribute named "styles" in your JSP.

Fix the typo and see if the problem goes away.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Tom Katz
Ranch Hand

Joined: Aug 19, 2002
Posts: 169
Doh! missed that typo . . .
Chandan Ghosh
Greenhorn

Joined: Jan 17, 2008
Posts: 2
It was indeed typo mistake...thank you all
 
wood burning stoves
 
subject: HTTP Status 500 - error running servlet with JSP