There is no Session for datasource / entity references unmapped class

Hey all!

So while updating a production app that was formerly running on CF 11 to Lucee 4.5/5 I’ve run into an application startup issue where the application starts and renders the home page but ORM does not fully instantiate all the entities in the app about 95% of the time.

Unfortunately the project is closed source so I cannot share the codebase but at this stage I’m fairly certain the issue is related to application startup logic. So what I’m looking for here is ideas on what could cause these sorts of exceptions.

Some high-level information about the application:

  • Uses FW/1 / Mura / Slatwall
  • Has ~250 Entity cfcs some of which are programmatically copied and altered on application startup

The errors I get are a combination of:

  • there is no Session for the datasource
  • entity x references unmapped class y
  • no entity found named x available entities are

Additionally when enabling the setting that builds the xml mappings with hibernate when these errors occur, not all the xml files are created further supporting the errors that these entities were not setup by ORM.

These errors will go away if ORMReload is programmatically called after the errors are thrown but this is not desirable because of its impact on application startup time. Also ORMReload is already being called during application startup and changing the point at which that happens does not fix the issue.

This stack overflow was insightful but in my case no ormsettings are being set programmatically outside of a pseudo constructor: https://stackoverflow.com/questions/35147525/lucee-orm-there-is-no-session-for-the-datasource

Any information/theories on the cause here would be greatly appreciated!