Skip to main content
Known Participant
March 30, 2009
Answered

Catching java.lang.NullPointerException with cftry/cfcatch?

  • March 30, 2009
  • 1 reply
  • 1798 views
I'm getting a java.lang.NullPointerException returned on an update function in a CFC:
"The cause of this output exception was that: java.lang.NullPointerException."

I want to find where it's generating this error so I can fix it. I've never really used CFTRY and CFCATCH, but figured now would be a good time to learn if this helped me track down the null. Can anyone provide an example of how to use these tags with the above NPE and output a message that give info on where it's faulting?

I'm using a standard update query,
<cfquery>
UPDATE table
SET columns = new values
WHERE ID column = some ID
</cfquery>
    This topic has been closed for replies.
    Correct answer Dan_Bracuk
    In your cfcatch block of code, mail yourself a cfdump of the cfcatch structure.

    1 reply

    Dan_BracukCorrect answer
    Inspiring
    March 30, 2009
    In your cfcatch block of code, mail yourself a cfdump of the cfcatch structure.
    Known Participant
    March 30, 2009
    That was a great tip Dan. Helped me find the line. Apparently a datatype "date" was given an incorrect null value. I figured the problem and the update works now :)

    Here's code incase someone wants to know: