Categories
ColdFusion

Fixing the Null Pointer Exception on ColdFusion



EDIT: This post was originally written with only MacOS in mind, and has been updated to serve as a generic solution

Null pointer exceptions., the NPE., can be a pain – especially with no debugging environment in place. Here’s a possible solution to one such NPE thrown by ColdFusion.

Right after installing ColdFusion, if you are confronted with a HTTP 500 Error and a Null Pointer exception on accessing the administrator, this post is for you!

Here is a more descriptive screenshot of the problem at hand.
MacHostnameError


This problem is most likely caused due to a missing hostname mapping in the hosts file. The hosts file needs to contain localhost, or the machine hostname if that is how ColdFusion is accessed through the browser. The solution for both, is below. An alternate way to identify this problem, is to check coldfusion-out.log entries. The licencing service would have failed to start with incorrect hostname mappings.

Generic solution for all machines
Edit the hosts file to see if a mapping for localhost and the machine hostname exists.

Location of the hosts file on Windows: C:\Windows\System32\drivers\etc\hosts
Location of the hosts file on Linux: \etc\hosts

If not, add the statement below,

127.0.0.1     localhost machine-hostname



An easier solution on Mac
Verify this is the case by running the below command. The result will likely not include “localhost”.

sudo scutil --get HostName

An easy way to fix this problem, is to run the below command, and restart ColdFusion.

sudo scutil --set HostName localhost


Voila! ColdFusion administrator must be accessible with the localhost / machine hostname now.

ColdFusion 11 - PDF Service prerequisites on Linux

By Immanuel Noel

A techie at heart. Works with Adobe at Bangalore, India. Currently do DevOps. Been a part of the ColdFusion Engineering team and the Flash Runtime Engineering team in the past. Was also a Flash Platform Evangelist, evangelizing the Adobe Flex platform. Spoke at numerous ColdFusion / Flash and Flex tech conferences. This blog is a collection of the more interesting problem and solutions I have worked on.

More on me on the home page

4 replies on “Fixing the Null Pointer Exception on ColdFusion”

Sadly, this solution did not work for me. Do you have any other suggestions? MacBook Pro w/Retina Display 15″ (Mid 2014).

This is getting really weird. I have reinstalled ColdFusion 11 from an installer dated 15-may-2014 using my admin account.
I ran the cold fusion start command twice, the first with sudo and the second without.
This is how I did it on my other two Macs that are running CF11 flawlessly.

I ran the administrator, still logged into my admin account and then logged off from my admin account to my working account that has no admin permissions. This is where it gets weird.

I had not stopped COldFusion when I logged off from admin and into my working account.
CF running fine.
If I stop and start while in my working account, I get a “Service not available” error that persists.
If I stop and start again, I get the 500 error for the NPE.
If i then log off and back on as admin, I still get the 500 error.
If I stop and start in my admin account, I get the “Service not available” error.
If I stop and start again, I get the ColdFusion 11 administrator site, no issues.
Is that weird enough for anyone?

@Jeff, I believe the setup you describe is configured with the Apache connector? Could you please apply the latest hotfix (HF3 is in early preview) and give a shot?
There were a number of bugs fixed regarding the connector on HF1, HF2 and HF3.

Leave a Reply

Your email address will not be published. Required fields are marked *