Skip to main content
BreakawayPaul
Inspiring
May 14, 2011
Question

Intermittent Null Pointer error

  • May 14, 2011
  • 1 reply
  • 3610 views

I'm in the process of building a website for my wife's new business.  Sometimes when I browse to the website, I get the following error:

The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.

Null Pointers are another name for undefined values.

[snipped links to resources and user agent stuff]

java.lang.NullPointerException

It only happens occasionally, and usually when I'm checking the page in a new browser.

Any ideas as to what could be causing it?

The only unusual part of my setup is that I've called the page header and footer from Application.cfc, like so:

<cffunction
   name="OnRequest"
   access="public"
   returntype="void"
   output="true"
   hint="Fires after pre page processing is complete.">

<cfargument
   name="TargetPage"
   type="string"
   required="true" />

<cfinclude template="includes/header.cfm" />
<cfinclude template="#ARGUMENTS.TargetPage#" />
<cfinclude template="includes/footer.cfm" />

<cfreturn />
</cffunction>

Perhaps this could be causing problems?

    This topic has been closed for replies.

    1 reply

    ilssac
    Inspiring
    May 16, 2011

    BreakawayPaul wrote:

    java.lang.NullPointerException

    That is just ColdFusion's (and it's underlining Java) telling you that you have used a variable that the progam is no idea about.  I.E. An Undefined Variable.

    If this is intermittant, somewhere in your code is a variable that does is not always getting defined when the application is executing.

    BreakawayPaul
    Inspiring
    May 16, 2011

    Yeah, I think it might have been #ARGUMENTS.TargetPage# that wasn't getting defined.  I added a default="index.cfm" to the <cfargument tag above, so we'll see if that helps.

    ilssac
    Inspiring
    May 16, 2011

    BreakawayPaul wrote:

    Yeah, I think it might have been #ARGUMENTS.TargetPage# that wasn't getting defined.

    That variable comes from the event handler when ColdFusion fires the onRequest event.

    I would have looked into the header.cfm and footer.cfm files first and see what variables are in those files and how they are being used.

    Finally, there is usually a fairly clear line number when this type of error is thrown.  Do you have "Enable Robust Exception Information" turned on in your development environment ColdFusion Administrator?