I am supporting a legacy Cold Fusion system and I cannot understand why every now and then I get the following error:
Element ROOT.DSN is undefined in APPLICATION.
The error appears seemingly on random places and does not make sense to me. If I understand how cold fusion works - every request first processes Application.cfm
, right?
There we have:
if (not isDefined('Application.Root'))
include '/lib/config/CreateRoot.cfm';
CreateRoot does some initialization and setting ROOT.DSN is one of them.
This doesn't make any sense to me, because usually the caller also loaded some stuff from database, so how come one function can "see" this and it's gone when we get into another? It's not ROOT.DSN but sometimes other settings, that we initialize the same way.
A retry is usually successful so the only explanation I can some up with is that the server is running some garbage collector and cleaning up some memory when this happens.
My questions are:
using the correct scope it's an important factor to prevent these issues. Please use "application.root.ds" to make sure you are indeed calling the correct scope. The application variable will only reset if you do the following:
other than that once the application runs for the first time you should always be able to access it and it should not restart.