Re: java.lang.NullPointerException (Tomcat)

Discussion in 'Java' started by Dhek Bhun Kho, Jul 9, 2003.

  1. 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.
    Dhek Bhun Kho, Jul 9, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Victoria
    Replies:
    4
    Views:
    640
  2. Mr Smith
    Replies:
    7
    Views:
    13,575
    Mr Smith
    Feb 21, 2005
  3. Fahad
    Replies:
    1
    Views:
    586
    Andrew Thompson
    Aug 8, 2005
  4. Replies:
    7
    Views:
    7,539
    Anonymous
    Oct 14, 2005
  5. tolu45
    Replies:
    3
    Views:
    539
    Robert Waters
    Nov 16, 2005
Loading...

Share This Page