OK, sorry about some delay with answering earlier posts. Life's been
hell for me these days, and I know probably the same for Dave, Kurt,
Sean, etc... Let's start at the top! I've changed all the instances
of 'parent' to 'variables.parent', don't know how that slipped
through, thanks for the catch!
As far as modifying 'containsBean' to look at the parent beanFactory,
this is not a real fix. Problem is in DefaultXmlBeanFactory,
containsBean is used to see if the bean is in the current factory,
not the parent, so I need to work on a better way to differentiate
between 'localFactoryContainsBean' and 'allFactoriesContainBean'.
I'll get back to you on this, because I swear I started something
here...
Now the third issue, why would a bean in the parent not re able to be
accessed by a bean in a subapp. Not sure here. I think we need more
info on what the setup exactly is. Can you post the pertinent xml
files to a test case and I'll work through it? I'm really trying to
get as much done this week as I can, so anything you give me as far
as a test case is a super big help, but please, I really don't have
time to create tests cases to match what you may be doing, I'm
working my ass of right now!
Thanks, Chris
Chris Scott
[EMAIL PROTECTED]
http://cdscott.blogspot.com/
http://www.coldspringframework.org/

On May 23, 2006, at 8:54 AM, Ruud Hermans wrote:
I managed to find out where things go wrong.
I have a main.services.xml, versioncontrol.services.xml and
profile.services.xml. The latter two are subapplications, therefore
carrying their own services.
Now, I have a service that is used by both subapplications, so I
figured I define it in main.services.xml (which also holds all
services for the main application), so I have to define it only
once. And this is where coldspring returns 0 instead of the actual
object.
This led me to the bug in getBeanFromSingletonCache() I wrote about
in my last email. After fixing the bug (have objExists set to false
when there's no object around) I quickly found out what the problem
actually is:
When a service is defined in main.services.xml, but only is used by
sub services.xml files, the service is never instantiated. And that
leads to an error when coldspring tries to feed the service into a
mach-ii listener (or any other bean for that matter).
If I use the service in the main application (by simply putting a
setter in a listener), everything works as it should. Apart from
the fact that you have a setter in a place it has no use.
Note: I had to alter containsBean() so it checks its possible
parent for the bean as well, to get this sub-services.xml stuff
working in the first place.
Regards,
Ruud
Ruud Hermans schreef:
Hello,
I've encountered a situation where mach-ii throws an error because
coldspring is trying to put the value 0 instead of an object into
a listeners' setter. I'm working my way through the coldspring
code (BER) to find out why this is happening.
In doing so, I noticed a strange bit of code in the method
getBeanFromSingletonCache in DefaultXmlBeanFactory.cfc.
Here's the code:
<cffunction name="getBeanFromSingletonCache" access="public"
returntype="any" output="false">
<cfargument name="beanName" type="string" required="true" />
<cfset var objRef = 0 />
<cfset var objExists = true />
<cflock name="bf_#variables.beanFactoryId#.SingletonCache"
type="readonly" timeout="5">
<cfif StructKeyExists(variables.singletonCache, beanName)>
<cfset objRef = variables.singletonCache[beanName] />
<cfelse>
<cfset objExists = true />
</cfif>
</cflock>
<cfif not(objExists)>
<cfif isObject(parent)>
<cfset objRef =
variables.parent.getBeanFromSingletonCache(arguments.beanName)>
<cfelse>
<cfthrow message="Cache error, #beanName# does not
exists">
</cfif>
</cfif>
<cfreturn objRef />
</cffunction>
Now, if you ask me, the variable objExists will never be false,
therefore the second part of the function will never be executed.
Just thought I mention it.
Oh, and the component variable 'parent' in
DefaultXmlBeanFactory.cfc isn't scoped in about 16 places.
And now I'll just go back figuring out this 0-thing.
Regards,
Ruud