tracker issue : CF-4198301

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

ORM Fails in WebSocket Listener

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/CannotReproduce

Reporter/Name(from Bugbase): John Garrett / John Garrett ()

Created: 02/01/2017

Components: Web Socket

Versions: 11.0

Failure Type: Non Functioning

Found In Build/Fixed In Build: ColdFusion11,0,11,301867 (Hotfix 11) /

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Windows 7 64-bit

Vote Count: 0

Problem Description:
EntityLoad fails when running in a WebSocket listener. I suspect this is related to getApplicationMetadata() returning an empty structure, thus indicating the ORM Settings in the application.cfc are not available within websockets.

Steps to Reproduce:
1) Create an application with ORM functionality.
2) Setup a websocket (WS).
3) Create a listener for the WS
4) In the allowSubscribe() method of the listener, use entityLoad() to load an ORM object from a database.

Actual Result:
coldfusion.orm.hibernate.HibernatePersistenceManager$EntityLoadException: Error while loading the entity.
at coldfusion.orm.hibernate.HibernatePersistenceManager.load(
at coldfusion.orm.ORMUtils.entityLoad(
at coldfusion.runtime.CFPage.EntityLoad(

Expected Result: 
The typical result of EntityLoad().

Any Workarounds:
Not using ORM, though entire application is built on ORM already.



I have come up with the following workaround, but it uses undocumented Java methods and may cause other issues, so use at your own risk. Create the following function in your WebSocket listener and call it in any function that needs ORM functionality. (In ColdBox, it is needed whenever you want to use any service because it checks the ORM settings when building the service instance.) private void function exposeAppSettings() { local.appProxy = createObject("java","coldfusion.runtime.AppEventInvoker").init(application.root.path & "application.cfc"); local.appHelper = createObject("java","coldfusion.runtime.AppHelper").init(getPageContext(), appProxy.getThisScope(), getPageContext().getFusionContext()); getPageContext().getFusionContext().setAppHelper(appHelper); }
Comment by John G.
1256 | February 02, 2017 11:50:51 PM GMT
Hi John, Please provide the information mentioned below: 1. Settings Summary 2. Database being used with application 3. Sample code to repro this issue.
Comment by Nimit S.
1257 | July 05, 2017 11:42:33 AM GMT
When do you need this by? I ask because I submitted the ticket 5 months ago and do not have the information at hand. I also would need to write code from scratch as I cannot provide the code or database since they are proprietary.
Comment by John G.
1258 | July 05, 2017 01:38:42 PM GMT
I would really appreciate if you can share the app as soon as possible for you do it.
Comment by Nimit S.
1259 | July 07, 2017 12:43:19 PM GMT
It appears that ColdFusion 11 Update 12 has fixed this issue. Upon reconstructing the code in a brand new application I created for the purpose of providing code to you, I found that I could not reproduce the issue. I then went to the original application in which I encountered the issue and REMmed my fix code to test if the problem still exists there. Again I found that I could not reproduce the issue. So, as I noted, I believe that Update 12 has fixed this issue.
Comment by John G.
1260 | July 10, 2017 05:47:16 PM GMT
Thanks John for confirming that you are not facing this issue anymore. Hence, I am closing this case.
Comment by Nimit S.
1261 | July 10, 2017 06:04:33 PM GMT