| Author |
Null Pointer Exception error
|
Viral Patel
Greenhorn
Joined: Aug 12, 2008
Posts: 8
|
|
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
Joined: Nov 21, 2007
Posts: 349
|
|
Hi Viral, I think you have posted this topic in two places. Regards, Ananth Chellathurai
|
Ananth Chellathurai [Walk on software]
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26489
|
|
Viral, What code creates the result set and puts it in the session? Is it getting executed in Tomcat 6?
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Viral Patel
Greenhorn
Joined: Aug 12, 2008
Posts: 8
|
|
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
internet detective
Marshal
Joined: May 26, 2003
Posts: 26489
|
|
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.
|
 |
 |
|
|
subject: Null Pointer Exception error
|
|
|