Hi all,
One of my applications seems to randomly re-initialize itself and throw an
error while doing so. It seems that every now and then FB executes the
appinit global fuseaction although the app is constantly being used.
During the appinit phase I initialize the ColdSpring service factory and
then retrieve three service cfcs from the factory and store them in
application scope. While retrieving the last service, CF sometimes throws
an error "Element SERVICEFACTORY is undefined in a CFML structure
referenced as part of an expression." This never occurs during regular
initialization, but, within seconds of another page request to the same
application.
The error always occurs on the same line of the parsed file that Fusebox
generates. The same service factory that bombs on this line is used on the
lines before without throwing an error. The statement in question is
surrounded by a conditional statement that checks whether FB is loaded or
not (apparently it isn't at time of error) and an exclusive lock.
At first I thought that someone had used fusebox.loadclean=true, so I
changed the fusebox.password, but, to no avail.
My questions here are: are there conditions when FB suddenly needs to
re-initialize without being told to do so? And why should the service
factory be non-existing, while is has existed on the line before?
The setup: FB 5.5/ColdSpring/CF 8.01 Enterprise on Windows
Below you'll find some code (hints about errors included for readability).
Thank you
Chris
fusebox.xml.cfm:
<globalfuseactions>
<appinit>
<fuseaction action="m.initialize"/>
</appinit>
</globalfuseactions>
circuit.xml.cfm of circuit "m" :
<circuit access="internal" xmlns:cs="path_to_coldspring">
<fuseaction name="initialize">
<set name="defaultProperties" value="#StructNew()#" />
<set name="defaultProperties.dsn" value="#request.dsn#" />
<cs:initialize coldspringfactory="servicefactory"
defaultproperties="#defaultProperties#">
<cs:bean beanDefinitionFile="#ExpandPath('coldspring.xml')#" />
</cs:initialize>
<cs:get bean="SearchParamService"
returnvariable="application.SearchParamService"
coldspringfactory="serviceFactory"/>
<cs:get bean="ReferenceService"
returnvariable="application.ReferenceService"
coldspringfactory="serviceFactory"/>
<!-- this sometimes errors out -->
<cs:get bean="LanguageService"
returnvariable="application.LanguageService"
coldspringfactory="serviceFactory"/>
<set name="application.qLanguages"
value="#application.LanguageService.getLanguages()#" />
<set name="application.sizes"
value="#application.searchParamService.getPictureSizes()#" />
<set name="application.Languages"
value="#application.searchParamService.getLanguagesAsStruct()#" />
</fuseaction>
</circuit>
from the parsed file (empty lines inserted for readability):
<cfset application.SearchParamService =
myFusebox.getApplication().getApplicationData().serviceFactory.getBean(beanN
ame="SearchParamService")/>
<cfset application.ReferenceService =
myFusebox.getApplication().getApplicationData().serviceFactory.getBean(beanN
ame="ReferenceService")/>
<!-- this sometimes errors out -->
<cfset application.LanguageService =
myFusebox.getApplication().getApplicationData().serviceFactory.getBean(beanN
ame="LanguageService")/>