Original message from
(shaab mohagir) on Thu, 22
May 2003 19:12:44 -0700:
SM> The JavaBean code compiles and runs fine off line, I can connect to
SM> the DB I get my results correct and everything is smooth until I try
SM> to use the bean in a JSP page.
Have you made sure the driver is available within the context? (place it
in the correct directory of the WEB-INF)
SM> root cause
SM>
SM> java.lang.NullPointerException
SM> at star.TAStatus.getCount(TAStatus.java:50)
SM>
This could be anything,
I don't know where line 50 it (:set nonu in vi points it at the return
rst.getString()).
If it did happen at the return rst.getString() then there must
be some message logged in your logfile if you have turned loggin on.
You should have rethrown the SQLException in the catch clause.
Since if the connection does not exist, your servlet will not detect it as
such, and you will get a NullPointerException instead.
Furthermore you are introducing a possible bug. You call
rst.next() but do not check on the return value, the servlet will probably
crash in such an event.
Greets.