|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Caching XML in cfcs MX 7 problem?
Hi,
We're running quite a few large applications under Mach-II. Some of our objects are using xml to hold specific settings, the xml is read in and parsed to an xml document which is then saved in the objects variables scope. Then throughout the objects life some of the methods perform xml searches etc. on this xml document as part of their action. This has all being working fine. However when switching to MX 7 we're having problems, sometimes exceptions are thrown with no message, detail or extended info and sometime exceptions with "Element XMLATTRIBUTES. ... is undefined in a Java object of type class coldfusion.xml.XmlNodeMap referenced as " within the methods that perform actions on the cached xml document. However this does not happen consistantly (we're having a hard time re-creating on our development environment) and everything seems to be fine for a while until suddenly it all goes pear shaped. I'm thinking it could be some sort of thread safe issue with some of the xml functions we're using, but I'm not sure as the inconsistancy of it is making it hard to debug. Does anyone have any ideas/experience with a problem like this. If you need any more information/clarification please tell me as this issue is beginning to kill me. -D |
|
#2
|
|||
|
|||
|
Can you confirm that the Mach-II app in question is in PRODUCTION mode and not development mode?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
Quote:
Yes it is in production mode, with reload config set to dynamic (whenever the mach-ii file changes). The mach-ii isn't reloading. A rough example of our main problem file is, I'll just leave in the important bits with some comments describing any strange behaviour we are seeing in MX7 : Code:
<cfcomponent displayname="Client Side Include Schema" extends="MachII.Framework.Listener">
<cfscript>
variables.cssSchemaObj = "";
variables.schemaPath = "";
// etc.
</cfscript>
<cffunction name="configure" access="public" returntype="void" output="false">
<cfset var xmlString = '' />
<!---
In the configure we pickup all the params etc and set them in the variables scope where applicable.
--->
<cffile action="read" file="#variables.schemaPath#" variable="xmlString" />
<!--- create the xml object --->
<cfset variables.cssSchemaObj = xmlParse(xmlString) />
</cffunction>
<cffunction name="getIncludes" access="public" returntype="struct" output="true">
<cfargument name="event" type="MachII.framework.Event" required="yes" />
<cfscript>
var includes = structNew();
var pageName = lcase(arguments.event.getArg("pageID"));
// etc.
includes.styles = arrayNew(1);
includes.scripts = arrayNew(1);
// set the stylesheet paths
node = xmlSearch(variables.cssSchemaObj, "//page[@name='#pageName#']");
if(not arrayIsEmpty(node) AND isArray(node[1].xmlChildren)){
for(i=1; i LTE arrayLen(node[1].xmlChildren); i=i+1){
if(node[1].xmlChildren[i].xmlName is "stylesheets"){
style = structNew();
style.media = node[1].xmlChildren[i].xmlAttributes.media;
style.stylesheets = arrayNew(1);
/*
NOTE : node[1].xmlChildren[i].xmlChildren contains the expected
nodes etc. when added to the debug of the exception email notices
*/
for(x=1; x LTE arrayLen(node[1].xmlChildren[i].xmlChildren); x=x+1){
/*
Loop through all the children and do stuff with them, this is where we have problems.
Although in the debug of the exception email node[1].xmlChildren[i].xmlChildren has the expected nodes and attributes this next part falls over (sometimes with a blank exception, sometime not).
If I try adding node[1].xmlChildren[i].xmlChildren[x] to
the exception debug then I usually get 'undefined array index'.
*/
row = node[1].xmlChildren[i].xmlChildren[x].xmlAttributes.path;
}
}
}
return includes;
</cfscript>
</cffunction>
</cfcomponent>
Someone on the Macromedia forum suggested that the variable settings in the pseudo constructor could be an issue - but I don't think that's it. -D |
|
#4
|
|||
|
|||
|
No that's not it because the pseudoconstructor area is only executed on object instantiation. Also, the configure method is only run when the listener is instantiated, so after that point the xml data should always be available in variables.cssSchemaObject.
I would try wrapping the section of code that seems to be generating the error with a try/catch block and then email or log additional information to yourself to help diagnose. For example, is the entire XML document object empty, or is it just one particular element that is blowing up? Etc. You might also try using cflog or the Mach-II trace plugin to ensure that the configure method is only running once, etc. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Caching XML in cfcs MX 7 problem? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|