wood burning stoves*
The moose likes Servlets and the fly likes exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "exception" Watch "exception" New topic
Author

exception

rakhi sinha
Ranch Hand

Joined: Mar 26, 2012
Posts: 147
Hoe to remove this exception


HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Integer.java:415)
java.lang.Integer.parseInt(Integer.java:497)
LoginExample.Generatepdf.doPost(Generatepdf.java:123)
LoginExample.Generatepdf.doGet(Generatepdf.java:29)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
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.32 logs.

Hemanth Mummadi
Greenhorn

Joined: Mar 28, 2012
Posts: 4
You must be trying to parse null somewhere in your servlet. Check that out. Information provided by you was insufficient, you can paste the code snippet which is causing this issue.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

Answered here http://www.coderanch.com/t/571442/Servlets/java/exception


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
rakhi sinha
Ranch Hand

Joined: Mar 26, 2012
Posts: 147
Hemanth Mummadi wrote:You must be trying to parse null somewhere in your servlet. Check that out. Information provided by you was insufficient, you can paste the code snippet which is causing this issue.



int i=1;
int t_cost=0;
while (rs.next())
{
String s = new Integer(i).toString();
table.addCell(s);
b1=rs.getString("I");
b2=rs.getString("IT");
table.addCell(b1+" and "+b2);
b3=rs.getString("Q");
table.addCell(b3);
b5=rs.getString("P");
table.addCell(b5);

i=i+1;
}
table.setSpacingAfter(30);
document.add(table);
String str= String.valueOf(t_cost);
table.setHorizontalAlignment(Element.ALIGN_LEFT);

p12.setAlignment(Element.ALIGN_RIGHT);
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
You'll have to examine the values that you're passing into the parseInt method; it seems they are not all integers (or maybe null).
Hemanth Mummadi
Greenhorn

Joined: Mar 28, 2012
Posts: 4
Agree with Tim. Check what are you passing in b5 and b3. It is safe to have null checks before you parse something or you should be catching NumberFormatException.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: exception
 
Similar Threads
Getting NumberFormat Exception
Integer.parseInt
Not able to add values in a database
forEach not working
NumberFormatException: D - what's this D?