Cached Reactor.xml?

0 views
Skip to first unread message

Jin Lei

unread,
Apr 24, 2009, 6:44:44 PM4/24/09
to Reactor
Not sure if anyone here comes to the same situation - my Reactor.xml
configuration seems got cached. No matter how I change <object> tags
and <relate> child tags inside, it just could not generate the right
relationship method(s).

<objects>
<object name="institution_tool_action"
alias="InstitutionToolAction">
<hasOne name="InstitutionTool">
<relate from="tool_id" to="tool_id" />
</hasOne>
</object>
<object name="institut_event" alias="InstitutEvent">
<hasOne name="InstitutionUser">
<relate from="added_by" to="user_id" />
</hasOne>
</object>
<object name="institution_tool" alias="InstitutionTool" />
<object name="institution_user" alias="InstitutionUser" />
</objects>


And it turns out -
Message Object 'InstitutionToolAction' does not exist.

My environment is Coldsprint + MG + Reactor.

Any hints?

Tom Chiverton

unread,
Apr 27, 2009, 7:41:02 AM4/27/09
to Reactor
On Apr 24, 11:44 pm, Jin Lei <lei...@yahoo.com> wrote:
> configuration seems got cached. No matter how I change <object> tags
> and <relate> child tags inside, it just could not generate the right
> relationship method(s).

How are you restarting Reactor ? Are you clearing the generated files,
for instance ?

> Message  Object 'InstitutionToolAction' does not exist.

Either the name is wrong or the user the DSN connection details say to
use doesn't have permission to see it.
Probably.

Jin Lei

unread,
Apr 27, 2009, 12:23:44 PM4/27/09
to Reactor
> How are you restarting Reactor ? Are you clearing the generated files,
> for instance ?

Yes, I cleared all generated files (from the generated project
folder); other than this, I did nothing on "restarting Reactor".

> Either the name is wrong or the user the DSN connection details say to
> use doesn't have permission to see it.
> Probably.

the DSN and the alias object(table) name work fine with the same
configuration. The only change I did is - making some changes on
Reactor.xml and changing it back.

Thanks for the reply.

Jin Lei

unread,
Apr 27, 2009, 1:11:09 PM4/27/09
to Reactor

Hey Tom, I fixed the problem by moving the object creator -
<cfset Reactor = CreateObject
("Component","reactor.reactorFactory").init(expandPath("config/reactor/
Reactor.xml")) />

from application.cfm to a normal cfm. Thanks anyway.

denstar

unread,
Apr 27, 2009, 2:42:07 PM4/27/09
to reacto...@googlegroups.com
If you're not using ColdSpring to manage your Reactor instance, you probably want to put it in the application scope.

For when I'm not using CS, I use Application.cfc with this for onApplicationStart:

<cffunction name="onApplicationStart">
<cfset var reactorConfig = CreateObject("Component", "reactor.config.config")/>
<cfscript>
 reactorConfig.init("/path/to/config/Reactor.xml");
 reactorConfig.setMapping("/path/to/model/data");
 reactorConfig.setDsn(this.dsource);
 reactorConfig.setProject("myproject");
 reactorConfig.setType("mysql");
 reactorConfig.setMode("production");
</cfscript>
<cfset application.Reactor = CreateObject("Component", "reactor.reactorFactory").init(reactorConfig) />
</cffunction>

And with this onRequestStart:

<cffunction name="onRequestStart" returntype="void">
    <cfargument name = "requestname" required="true"/>
    <cfif structKeyExists(url,"init") AND url.init eq "mysecretkey"><cfset onApplicationStart() /></cfif>
</cffunction>

Tho I don't know how cool it is to re-run the onApplicationStart (seems to work fine for me).

Regardless, the idea is that you don't instantiate a reactor factory with each request, as it looks like you've switched to?  It should live in the application scope.

Sounds like maybe it was in the application scope, and not getting re-initted?  Had you tried restarting your CF instance to see if the changes were then picked up?

--
The deadliest foe to virtue would be complete self-knowledge.
F. H. Bradley

Jin Lei

unread,
Apr 27, 2009, 3:08:24 PM4/27/09
to Reactor

Thanks denstar, your solution seems a nice one!
Reply all
Reply to author
Forward
0 new messages