jQuery in Action, 2nd edition*
The moose likes Servlets and the fly likes Error - HTTP 505 - Status report Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Error - HTTP 505 - Status report" Watch "Error - HTTP 505 - Status report" New topic
Author

Error - HTTP 505 - Status report

tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
Hi there,

I am now trying to recreate the same files in another folder. But, when I run my jsp which is to process the data and post it up to Ms access table, it gives me the following message. Hope someone can advise how to rectify the problem. Million Thanks.


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 /processAddMember.jsp at line 27

24:
25:
26: //collect information from the form data
27: strFullName = request.getParameter("txtFullName").trim();
28: strEmail = request.getParameter("txtEmail").trim();
29: strAddress = request.getParameter("txtAddress").trim();
30: strNRIC = request.getParameter("txtNRIC").trim();


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)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)


root cause

java.lang.NullPointerException
org.apache.jsp.processAddMember_jsp._jspService(processAddMember_jsp.java:80)
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)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)


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

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12681
    
    5
27: strFullName = request.getParameter("txtFullName").trim();


Will throw a NPE if getParameter() returns null because there is no parameter by that name or if the request reference is null.

Im betting on the first, so you need to code defensively.

Bill

Java Resources at www.wbrogden.com
Charles 'King
Ranch Hand

Joined: Jul 05, 2009
Posts: 56

As reiterated by William, either check for null values on the client-side (javascript) or in your servlet/jsp; e.g.

Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 642
Charles 'King wrote:As reiterated by William, either check for null values on the client-side (javascript) or in your servlet/jsp; e.g.



Or perhaps:

I mean, why call req.getParameter() twice?
Charles 'King
Ranch Hand

Joined: Jul 05, 2009
Posts: 56


Or perhaps:

I mean, why call req.getParameter() twice?


My response to the OP was meant to simplify the answer for him. For instance, semantically your code could be refactored:
tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
Thank you guys. Your replies are just too difficult to comprehend.

Due to urgency, I've tried to create new folder for the project.

Thanks anyway.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 642
tangara goh wrote:Thank you guys. Your replies are just too difficult to comprehend.

Due to urgency, I've tried to create new folder for the project.

Thanks anyway.


What don't you understand? If you attempt to dereference a null variable, you'll get a NullPointerException. Your error was showing that your code was dereferencing a null variable. This is Java 101 (actually, the same is true in many programming languages).

Best Regards,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error - HTTP 505 - Status report
 
Similar Threads
how to solve the error
Jsp failed to execute in Netbeans
I got http-500 error in servlet and jsp.how to find error?
Module 'null' not found
Struts1 - tiles -cascading tiles:insert