tracker issue : CF-4126264

select a category, or use search below
(searches all categories and all time range)

serializeJson on ORM entity throws a runtime NullPointerException in some cases.

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Geoffrey Demoulin / Geoffrey Demoulin (Geoffrey Demoulin)

Created: 03/08/2016

Components: Language, Serialization

Versions: 11.0

Failure Type: Crash

Found In Build/Fixed In Build: CF11_Final / 2016

Priority/Frequency: Critical / Some users will encounter

Locale/System: English / Windows 8.1/64bit

Vote Count: 1

Problem Description:

When trying to serialize an ORM entity to Json, a NullPointerException is thrown in specific situations.

To test, I have an extremely simple database with the following tables:

Delivery -> Package <-> PackageOrder -> Order





The Order entity has an extra field computed at runtime (persistent="false") with a custom getter:

	property name="hashid" type="string" setter="false" persistent="false";

	public string function getHashid(){
		return "COMPUTED" &;

When using the following code, the crash happens:

	public any function getObjectToSerialize(){
		var delivery = entityLoadByPK("Delivery", 1);
		var obj = delivery.getPackages()[1].getPackagedOrders()[1].getOrder();
		return obj;

	// Somewhere else:
		WriteDump(var=serializeJSON(getObjectToSerialize()), abort=true); // NullPointerException
	}catch(any e){
		WriteDump(var=e, abort=true);

Dumping the entity returned by getObjectToSerialize is working as intended.

The stack is available in the notes below.

Interestingly, deleting the custom getHashid getter will prevent the error from happening.

Steps to Reproduce:

Use the application in the attached zip.

Actual Result:


Expected Result:

A Json representation of the entity

Any Workarounds:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4126264

External Customer Info:
External Company:  
External Customer Name: Geoffrey Demoulin
External Customer Email:  
External Test Config: My Hardware and Environment details:


  1. March 09, 2016 00:00:00:


java.lang.RuntimeException: java.lang.NullPointerException at coldfusion.runtime.JSONUtils.getCFCDataAsMap( at coldfusion.runtime.JSONUtils.serializeJSONProxy( at coldfusion.runtime.JSONUtils.serializeJSONBase( at coldfusion.runtime.JSONUtils.serializeJSON( at coldfusion.runtime.JSONUtils.serializeJSON( at coldfusion.runtime.JSONUtils.serializeJSON( at coldfusion.runtime.CFPage.SerializeJSON( at cfindex2ecfm832620916.runPage(D:\src\Projects\test.local\index.cfm:12) at coldfusion.runtime.CfJspPage.invoke( at coldfusion.tagext.lang.IncludeTag.handlePageInvoke( at coldfusion.tagext.lang.IncludeTag.doStartTag( at coldfusion.runtime.CfJspPage._emptyTcfTag( at cfapplication2ecfc853940087$funcONREQUEST.runFunction(D:\src\Projects\test.local\application.cfc:40) at coldfusion.runtime.UDFMethod.invoke( at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke( at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke( at coldfusion.filter.FunctionAccessFilter.invoke( at coldfusion.runtime.UDFMethod.runFilterChain( at coldfusion.runtime.UDFMethod.invoke( at coldfusion.runtime.TemplateProxy.invoke( at coldfusion.runtime.TemplateProxy.invoke( at coldfusion.runtime.TemplateProxy.invoke( at coldfusion.runtime.AppEventInvoker.invoke( at coldfusion.runtime.AppEventInvoker.onRequest( at coldfusion.filter.ApplicationFilter.invoke( at coldfusion.filter.MonitoringFilter.invoke( at coldfusion.filter.PathFilter.invoke( at coldfusion.filter.LicenseFilter.invoke( at coldfusion.filter.ExceptionFilter.invoke( at coldfusion.filter.ClientScopePersistenceFilter.invoke( at coldfusion.filter.BrowserFilter.invoke( at coldfusion.filter.NoCacheFilter.invoke( at coldfusion.filter.GlobalsFilter.invoke( at coldfusion.filter.DatasourceFilter.invoke( at coldfusion.filter.CachingFilter.invoke( at coldfusion.CfmServlet.service( at coldfusion.bootstrap.BootstrapServlet.service( at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( at org.apache.catalina.core.ApplicationFilterChain.doFilter( at coldfusion.monitor.event.MonitoringServletFilter.doFilter( at coldfusion.bootstrap.BootstrapFilter.doFilter( at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( at org.apache.catalina.core.ApplicationFilterChain.doFilter( at coldfusion.inspect.weinre.MobileDeviceDomInspectionFilter.doFilter( at coldfusion.bootstrap.BootstrapFilter.doFilter( at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( at org.apache.catalina.core.ApplicationFilterChain.doFilter( at org.apache.catalina.core.StandardWrapperValve.invoke( [...]
Comment by External U.
4362 | March 08, 2016 09:59:48 PM GMT
[...] at org.apache.catalina.core.StandardContextValve.invoke( at org.apache.catalina.authenticator.AuthenticatorBase.invoke( at org.apache.catalina.core.StandardHostValve.invoke( at org.apache.catalina.valves.ErrorReportValve.invoke( at org.apache.catalina.core.StandardEngineValve.invoke( at org.apache.catalina.connector.CoyoteAdapter.service( at org.apache.coyote.ajp.AjpProcessor.process( at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process( at$ at java.util.concurrent.ThreadPoolExecutor.runWorker( at java.util.concurrent.ThreadPoolExecutor$ at org.apache.tomcat.util.threads.TaskThread$ at Caused by: java.lang.NullPointerException
Comment by External U.
4363 | March 08, 2016 09:59:53 PM GMT
Any news on this bug? The test case provided should be all that is needed to reproduce the issue.
Comment by External U.
4364 | June 10, 2016 12:54:15 AM GMT
Hi Geoffrey, We did try out the test case you provided. Thanks for the extensive information provided. We were however unable to repro this issue on CF 2016, or CF 11 with Update 9 applied. No exceptions were thrown even when the getHashid() method was invoked. Could you please confirm the hotfix version applied on the server? - Immanuel
Comment by Immanuel N.
4365 | June 13, 2016 04:29:03 AM GMT
Hi Immanuel, I'm currently running cf11u8, which I believe is the latest publicly available patch.
Comment by External U.
4366 | June 13, 2016 05:51:40 PM GMT
The update 9 for cf11 popped up this morning and I installed it. This installation of ColdFusion is also new since I changed my computer recently. I am now running windows 10/x64. Unfortunately the issue persists. You mentioned that no error occurred when you tested, does this means that you got the dump of the serialized object?
Comment by External U.
4367 | June 14, 2016 07:55:40 PM GMT
Geoffrey, I dint see the issue since the CFC loads only for the first invocation in the example. Altered the example slightly, added ormreload() and we see the issue. Thanks for raising this. I can confirm the issue does not exist on CF 2016. Will be tracking this for CF 11 and CF 10. - Immanuel
Comment by Immanuel N.
4368 | June 16, 2016 02:15:35 AM GMT
This is fixed in 2016. We will evaluate to see if the fix can be back-ported to earlier versions.
Comment by Vamseekrishna N.
4369 | August 03, 2016 03:31:53 AM GMT
We have just encountered this after "upgrading" from ACF10 (where this worked correctly). Could you update this ticket with a justification for why this could not be fixed in a supported product?
Comment by Samuel K.
4370 | April 24, 2017 08:42:36 PM GMT
This fix will be backported to 11.0 and will be made available in the next bug-fix update release for 11.0
Comment by Vamseekrishna N.
4371 | September 14, 2017 04:10:42 PM GMT