• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Null Pointer Exception error

 
Viral Patel
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...

I am getting error of java.lang.NullPointerException.

Previously I used Tomcat 4.0 and my code is working fone...

but when I upgraded my tomcat 4.0 to tomcat 6.0 it gives me the error of java.lang.NullPointerException.

Please help me ....
it gives error of NullPointerException on line
int id = Integer.parseInt(cachedRS.getString("SerialNo"));

here is the code...

 
Ananth Chellathurai
Ranch Hand
Posts: 349
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Viral,

I think you have posted this topic in two places.

Regards,
Ananth Chellathurai
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34839
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Viral,
What code creates the result set and puts it in the session? Is it getting executed in Tomcat 6?
 
Viral Patel
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using file connLoad.jsp for connection and init resultset
its works fine in other files as well as if I run the same code using tomcat4 then it works but in tomcat 6 its not working....

here is the code of connLoad.jsp




please reply as im stucked and waiting for solution

thanks in advvance
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34839
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Viral,
First, note that it is considered bad practice to put Java code - especially database code - in a JSP. It should be in Java objects.

Have you looked at the logs or what line the NullPointer is thrown on yet?

The following code jumps out at me as a problem. If there is an exception loading the connection, a message is logged and the code continues with the connection set to null. This invites the code to blow up later when someone tries creating a statement from that connection.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic