title: NullPointerExceptions in ColdFusion 9 and ColdBox on localhost
body: <p>I'm running CF 9.0.1 Developer and Coldbox 3.0.0 on my local machine (64-bit Windows Vista running 32-bit CF9 on Apache). I'm working on an application that I've checked out from SVN and deployed locally. Everything seems to be working correctly, but my application log is filling up with entries like this:</p>
  
  <pre><code>Apr 18, 2011    12:41 PM    Error       jrpp-7   
  </code></pre>
  
  <p>exception.log has an extremely long stack trace for each exception, maybe 150 lines or so. It starts with this: </p>
  
  <pre><code>"Error","jrpp-4","04/18/11","11:07:30",,""
  java.lang.NullPointerException
      at coldfusion.util.Utils.getServletPath(Utils.java:86)
      at coldfusion.util.Utils.getServletPath(Utils.java:76)
      at coldfusion.util.Utils.getBaseTemplatePath(Utils.java:405)
      at coldfusion.runtime.TemplateProxyFactory.getTemplateFileHelper
          (TemplateProxyFactory.java:1522)
      at coldfusion.runtime.MetadataUtils.getComponentMetadata
          (MetadataUtils.java:112)
      at coldfusion.runtime.CfJspPage.GetComponentMetaData(CfJspPage.java:2667)
      at coldfusion.runtime.TemplateProxy.getRuntimeComponentMetadata
          (TemplateProxy.java:1756)
      at coldfusion.runtime.TemplateProxy.getRuntimeMetadata
          (TemplateProxy.java:1617)
      at coldfusion.runtime.MetadataUtils.getMetaData(MetadataUtils.java:54)
      at coldfusion.runtime.CfJspPage.GetMetaData(CfJspPage.java:2640)
      at cfEventHandler2ecfc862260423$funcPOSTLOAD.runFunction
          (C:\ColdFusion9\wwwroot\ybocv5\coldbox\system\orm\hibernate
              \EventHandler.cfc:30) 
  </code></pre>
  
  <p>This is a version of an app that has been running in production, and what makes me think this is just on my local version is the appearance of this in the stack trace:</p>
  
  <pre><code>at cfdump2ecfm471394032$funcRENDEROUTPUT.runFunction
      (E:\cf9_updates_rc\cfusion\wwwroot\WEB-INF\cftags\dump.cfm:704) 
  ...
  at cfCollectionPanel2ecfm961210602.runPage
      (C:\ColdFusion9\wwwroot\ybocv5\coldbox\system\includes
          \panels\CollectionPanel.cfm:40) 
  </code></pre>
  
  <p>We don't use cfdump in production; this looks like ColdBox is trying to display a complex object in a debugger panel and failing.</p>
  
  <p>The only thing I found online so far was <a href="http://groups.google.com/group/transfer-dev/browse_thread/thread/27b8e8f09b56da53/860b2e9f44daadaf?hl=en&amp;lnk=gst&amp;q=NullPoint+exceptions#860b2e9f44daadaf" rel="nofollow">this thread</a> in Google's transfer-dev group ... someone who saw a bunch of similar errors and thought maybe it was a CF9 bug. The only reply with any sort of solution was <a href="http://groups.google.com/group/transfer-dev/browse_thread/thread/da513f7407e1a2d4/a0c4d495ac8ea61d?hl=en&amp;lnk=gst&amp;q=NullPoint+exceptions#a0c4d495ac8ea61d" rel="nofollow">this one</a>, suggesting a fix that seems to be Transfer-specific. </p>
  
  <p>Does anyone know what might be causing these errors? It's not as important to me to fix them as it would be on a production app, but if I'm spamming my logs with these errors, it's hard to find legitimate errors when they do occur.</p>
  
  <p><strong>Update:</strong> I've been working with the CollectionPanel.cfm template to identify the root cause, and the exception is consistently thrown here:</p>
  
  <pre><code>    &lt;cfelseif isObject(varVal)&gt;
          &lt;!--- this cfdump is the guilty party ... ---&gt;
          &lt;cfdump var="#varVal#" expand="false" top="2"&gt;
      &lt;cfelse&gt;
  </code></pre>
  
  <p>I've tried wrapping the <code>cfdump</code> in a try-catch, but the exception is thrown anyway, always from that same line of code. This makes sense, I guess, given that these errors don't have any visible effect on the pages on which they occur.</p>