ColdFusion 8, MySQL, HostMySite, and NPEs

This post is more than 2 years old.

So here is a weird one for you. I've got a bug report over on my Soundings forum where a user reports getting NPEs (Null Pointer Exceptions). The errors are random, and go away immediately if you refresh the page. If you read the thread, you will see that HostMySite is saying it is an issue with ColdFusion 8 and MySQL. Their "solution" is to roll back the client to ColdFusion 7.

Now what's odd is - I have a client who uses HostMySite, and they were having the same issues. Not with Soundings, but just with their CF code in general. (CF8+MySQL)

I finally put two and two together a few minutes ago. Is anyone else experiencing this? I've checked the client's code for obvious issues - and while I found a missing var statement or two - those were all patched up. The site has no load now at all.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by Raymond Camden posted on 9/29/2007 at 1:03 AM

FYI, I forgot my earlier post on this:


I wonder if we are seeing a bug in CF8+MySQL?

Comment 2 by Kevin Sargent posted on 9/29/2007 at 1:04 AM

I just launched a pretty intensive CMS on CF8 + MySQL 5 on a semi-dedicated server and have no issues like that that I am aware of.

Comment 3 by Phil Duba posted on 9/29/2007 at 1:17 AM

Ray, I got a number of these when I switched my site to be hosted by HMS. It is running CF8 and MySQL. The solution was to toggle and/or adjust the "Maintain Client Connections" and the Connection Timeout Settings. I have had no issues since the first day or two since these adjustments were made.

Comment 4 by James Edmunds posted on 9/29/2007 at 1:44 AM

Ray, that earlier post about the NPEs was in fact CF8 plus MySQL. I have had no problems at all since the OnRequest "fix" from the CT tech, though none of us seems to yet understand why it worked!

Comment 5 by tony petruzzi posted on 9/29/2007 at 1:53 AM

We were having weird problems as well. The cause turned out to be that the particular server our site was on was UPGRADED from cf7 to cf8. Apparently this is cause of a lot of these weird issues. If you call HostMySite they will switch your website over to a server that cf8 was freshly installed on.

Comment 6 by dave posted on 9/29/2007 at 4:10 AM

I had some weird issues with cfm8 vps servers but soon as I switched to a cfm8 ded box they all went away.

I know that helps but..... it seems as though the config has some issues to be worked out on cfm8.

Comment 7 by Ian posted on 9/29/2007 at 6:57 AM

This sounds like an issue I experienced repeatedly with HMS when and MySQL. To fix it, I had to go back into the DSN in the CF Admin and uncheck the box "Maintain connections across client requests." The error messages disappeared immediately.

I don't recall whether NPEs were a part of the error messages I received, but it sounds very familiar.

Comment 8 by Raul Riera posted on 9/29/2007 at 9:45 AM

I have developmed my own CMS using CF8 and MySQL on and no errors what so ever, there must be something odd with host my site or soundings :P hehehe just kidding

Comment 9 by Joe Mastroianni posted on 9/29/2007 at 4:02 PM

Maybe it's an issue with the mySQL driver? Maybe CF is maintaining a connection but the DB server is dropping it then boom! NPE. Or something. It's early.

Comment 10 by Will Tomlinson posted on 9/29/2007 at 9:43 PM

I did report a bug where I was getting an intermittent "corrupt table" error with MySQL/CF8/cfqueryparams.

They said that one's been fixed and will be in the next hotfix.

They also sent me the fix. I don't know if it's related at all tho. Doesn't sound like it..


Comment 11 by Tom K posted on 10/1/2007 at 12:39 PM

I had some problems on HMS just this last week installing BlogCFC w CF8 + MySQL: worked perfectly on Dev machine, but they were using the wrong MySQL driver on the DSN at HMS. Threw lots of errors, so it got fixed; then I started getting random timeouts when reinitializing the cache; So I request ?autoconnect=true added to the connection string and that seems to have worked thus far.

Before that, Occasionally, when I selected category view on Blog CFC I'd get a Null Pointer - and I had no idea why....

Comment 12 by Matteo Stagi posted on 10/1/2007 at 6:32 PM

I had the same problem on a site running CF and mySQL hosted at HostmySite. The problem began when HMS upgraded to CF8. But in my case the support was good and they fixed my Null Pointer Exceptions. So I asked more informations about how they solved it. They answered:

The fix was to add the following to the connection string for the DSN in ColdFusion Admin:


The fix has to to do with a bug in MySQL referenced here:

When using the MySQL 3.x drivers in CF7 this issue never revealed itself, but when upgrading to CF8 and using the MySQL 4/5 drivers, it popped up. Please let us know if you have any additional questions about this issue.

Comment 13 by jh posted on 10/2/2007 at 8:16 PM

" 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."

I'm actually getting those, too.

We're using CF8 that's connecting to a mySQL database on another network.

Refreshing the page causes the error to disappear.

Randomly just found this posting. Glad I did.

Comment 14 by jh posted on 10/2/2007 at 8:30 PM

Added that to the connection string. Still getting the errors.

Comment 15 by David Buhler posted on 10/30/2007 at 5:38 PM

According to an email I received from Alagad, a fix is now posted:

Comment 16 by Hal Crawford posted on 11/1/2007 at 9:16 PM

I have the same problem - and I have a pretty simple page with the HostMySite people. I'll try the connection string change, and see if someone can implement the Hot Fix. Crossing my fingers.....

Comment 17 by Dan posted on 11/6/2007 at 7:51 PM

This problem is probably related to a bug in CF8 mysql driver.. having HMS remove the "maintain connections" option from the DSN config should fix the problem.

Havnt seen the new Adobe hotfix on this yet. will have to check it out.

Comment 18 by sultan posted on 12/18/2007 at 4:54 AM

Null pointer exceptions.
We upgraded our server from CFmx7 to CF8 about a month ago with no issues until now. We are now getting intermittent NPEs. If you refresh a page, the error either goes away or shows a different NPE error. This was all working fine for a month after the upgrade.
We have CF8 installed on CentOS 3.8 with Mysql 4.1.
I have restarted CF8 and the issue is still persisting. I also updated with the CFhotfix 2 and restarted with the issue still persisting.

I'm thinking of uninstalling and reinstalling CF8 tonight. I will post my result.

Comment 19 by sultan posted on 12/18/2007 at 10:23 AM

I've given up for today.

Uninstalled Coldfusion 8 and did a complete re-install with no improvements. Still getting random intermittent Null Pointer Exceptions.

I talked with our server tech support and they informed me that Apache failed earlier today and had to restart. Thats about when this problem started. They re-compiled apache and I uninstalled and re-installed coldfusion again. This time the errors were less frequent but still there.

I'm not convinced that its a coldfusion issue since it worked without any issues for a month straight.

I also read on a forum that it may be the mysql 4/5 driver so I used the "other" setting for the datasource and the manual driver setup like you had to with CFMX7. Still same issue. Different errors every time you refresh.

Tomorrow i plan to install cfmx7 to test if the problem still occurs.

Will post my results

Comment 20 by Raymond Camden posted on 12/18/2007 at 4:57 PM

You may want to consider checking the version of MySQL you are using and ensuring that the connector is the same version. Thats another tip I've heard.

Comment 21 by sultan posted on 12/20/2007 at 7:36 AM

It seems to be working now.

Thanks Raymond and Matteo!

So initially, the mysql connection string (zeroDateTimeBehavior=convertToNull) didn't work, and unchecking the (Maintain connections across client requests)didn't work. After a third install of cf8 we still got the errors until I put the connection string in with the driver I used with cfmx7 as well as unchecking the Maintain connections across client requests option. Now its been working for over a day with no issues.

What puzzles me is why did it work for a month without any issues using the native Mysql 4/5 drivers?

Comment 22 by John Schroeder posted on 2/10/2009 at 2:15 AM

I had the same problem on 3 of my websites (shared server) with CrystalTech (now Newtek). The tech knew the fix immediately. The cold fusion admin for 7 was defaulted to have the checkbox for maintain connection unchecked, but cf8's default was checked. what's the word on a fix for the dsn/mysql issue? it would be nice to be able to maintain connections.

Comment 23 by Matt posted on 9/24/2009 at 5:49 PM

I was told, by Adobe, that they are not planning on fixing the issue in CF8, but "hopefully" it will work in CF9.

Comment 24 by Steve Logan posted on 12/21/2009 at 11:40 PM

I'm getting this now anytime I try to instantiate a CFC at Network Solutions CF hosting (client's choice, not mine). The db is Access, and I'm not even accessing it in the test CFC I wrote to show the problem to them. All I'm doing in my test CFC is returning the string 'foo' when it's called with cfinvoke.

They're running CF7, no CF8 servers, and very very little support from them. Client is running out of patience and is starting to talk "cf sucks, knew we should have converted the app to ASP".

Site - with some pretty complex CFCs works fine on my test server (CF8), and a 2nd server I installed the site on to show it to them working (CF7).

Comment 25 by delta posted on 1/14/2010 at 7:22 PM

"Comment 23 written by Matt on 24 September 2009, at 8:49 AM
I was told, by Adobe, that they are not planning on fixing the issue in CF8, but "hopefully" it will work in CF9"

"hopefully" it will work in CF9" --- Yeah and pay another $10 Grand for another licence

Comment 26 by Raymond Camden posted on 1/14/2010 at 7:46 PM

CF9 Enterprise, full price, isn't 10k. The upgrade for sure is a lot less.

Comment 27 by J Rudny posted on 5/20/2010 at 11:09 PM

CrystalTech customers can refer to this knowledgebase article below. It instructs contacting customer support to turn off the "maintain connections across client requests" that is enabled by default.


Comment 28 by Carsten posted on 6/14/2010 at 10:59 AM

We were having the same problems with several sites based on a cf8/mysql5 installation. After the addition of the connection String "zeroDateTimeBehavior=convertToNull" as mentioned above by Matteo Stagi AND removing the "maintain connections" option from the DSN config everything works fine. Thanks

Comment 29 by Choy May May posted on 8/2/2010 at 12:14 PM

Need to update a setting. I called Host My Site and the fixed the issue right away.

Comment 30 by David Levin posted on 2/2/2011 at 4:02 AM

This is an old article, but for anyone that cares this bug is still around and is not specific to ColdFusion 8 and mySQL. I'm using CF8 and MSSQL 2005 and I get this bug randomly when I instance a CFC. The problem immediately goes away when I hit refresh.

One interesting thing is that this only appears to happen after a fresh reboot of the server.