wood burning stoves*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HTTP Status 500 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HTTP Status 500" Watch "HTTP Status 500" New topic
Author

HTTP Status 500

srinivas.rao marasu
Greenhorn

Joined: Apr 04, 2006
Posts: 23
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

Did you check Line 24 of BeerSelect.java
What is it ?


[My Blog]
All roads lead to JavaRanch
srinivas.rao marasu
Greenhorn

Joined: Apr 04, 2006
Posts: 23
Line 24 in BeerSelect.java is :-view.forward(request,response);
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

view is null. What is view ?
srinivas.rao marasu
Greenhorn

Joined: Apr 04, 2006
Posts: 23
RequestDispatcher view = request.getRequestDispatcher("result.jsp");
Rajkishore Pujari
Ranch Hand

Joined: Sep 03, 2005
Posts: 46
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

Joined: Apr 04, 2006
Posts: 23
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

Joined: Apr 04, 2006
Posts: 23
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

Joined: Jun 08, 2006
Posts: 20
Hi,

i am also getting the same error at the line,

view.forward(request, response);

Any solution for this?
Muthuvel Ramamoorthy
Greenhorn

Joined: Jun 08, 2006
Posts: 20
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP Status 500