Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Status 500

 
srinivas.rao marasu
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,
In chapter3,HeadFirst Servlets&Jsp modified version of 3rd servlet along with jsp, while deploying on tomcat, i got this exception.I followed exactly as in the text book,but being still in chapter3 i am not able to figure out what this exception is about?why it occured?Any suggestion?

Exception:
----------

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:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.example.web.BeerSelect.doPost(BeerSelect.java:24)
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:52)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.example.web.BeerSelect.doPost(BeerSelect.java:24)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
Apache Tomcat/5.0.28
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check Line 24 of BeerSelect.java
What is it ?
 
srinivas.rao marasu
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Line 24 in BeerSelect.java is :-view.forward(request,response);
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
view is null. What is view ?
 
srinivas.rao marasu
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RequestDispatcher view = request.getRequestDispatcher("result.jsp");
 
Rajkishore Pujari
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Srinivas,
Path of the resource matters with RequestDispatcher

RequestDispatcher view = request.getRequestDispatcher("result.jsp");

I don't have book with me right now to check, to see what exactly you have done. But you have not included "/", that means its a relative path. Check where did you keep the result.jsp in the beer webapp.

If the path is not right, RequestDispatcher returns null and that might have thrown the exception.
 
srinivas.rao marasu
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai rajkishore,

Thank you for reply,However in the HeadFirst Servlets&Jsp modified version of servlet3 they have not mentioned "/",but still i followed your suggestion but still i am getting the same exception as described above.I followed exactly what it was mentioned the book,i rechecked the code too,but still don't know what is wrong? any suggestion?


Thank you.
 
srinivas.rao marasu
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
um.. after lot of frustation by tracing out the code,again and again finally i
got it,just a typing mistake about Style attribute.
 
Muthuvel Ramamoorthy
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i am also getting the same error at the line,

view.forward(request, response);

Any solution for this?
 
Muthuvel Ramamoorthy
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
************************************************************************
um.. after lot of frustation by tracing out the code,again and again finally i
got it,just a typing mistake about Style attribute.

************************************************************************
in the servlet : setting "styles" as follows...

request.setAttribute("styles", result);

in the jsp : getting "styles" as follows....

List styles = (List)request.getAttribute("styles");

Kindly point out whrere is the spelling mistake. I could not solve the problem yet.

Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic