Coldspring is loaded in Application.cfc

<cffunction name="onApplicationStart" output="false">

        <!--- setup coldspring bean factory --->
        <cfset defaultProperties = structNew()/>
        <cfset defaultProperties.dsn = 'mydb'/>
        <cfset application.factory = createObject("component","
coldspring.beans.DefaultXmlBeanFactory
").init(defaultProperties=defaultProperties)/>
        <cfset application.factory.loadBeansFromXmlFile
(expandPath("/mocca/app/config/services.xml"),true)/>
        <cfset application.factory.getBean("contactService_remote") />

        <cflog file="#this.name#" type="Information" text="Application
#this.name# Started">

       <cfreturn True>
   </cffunction>

Daniel

On 8/13/07, Peter J. Farrell <[EMAIL PROTECTED]> wrote:
>
>  Where and how are you init'ed ColdSpring?  Show code.
>
> .pjf
>
>
> Daniel Schmid said the following on 8/13/2007 11:39 AM:
>
> I try to get my first remoteProxy out of coldspring running and get stuck
> with
>
> "Sorry, a ColdSpring BeanFactory named  was not found in  scope. Please
> make sure your bean factory is properly loaded. Perhapse your main
> application is not running?"
>
> I know other had the same problems, I read
> http://www.remotesynthesis.com/blog/index.cfm/2007/7/16/Some-Tips-on-Using-ColdSpring-Remoting
>
> and
> http://www.remotesynthesis.com/blog/index.cfm/2007/7/20/Objects-and-Composition-Connecting-to-Flex
>
>
> cfc's and configuration files are outside webroot and mapped
>
> My setup:
>
> [modell]
> /mocca/{model}   -> with a mapping in cf to '/mocca'
> /mocca/config/services.xml
>
> CF8 in WEB-INF/flex/remoting- config.xml I set
> <use-mappings>true</use-mappings>
>
> ColdSpring definition:
>
> <bean id="contactService_remote" class="
> coldspring.aop.framework.RemoteFactoryBean">
>         <property name="target">
>             <ref bean="contactService" />
>         </property>
>         <property name="serviceName">
>             <value>contactServiceRemote</value>
>         </property>
>         <property name="beanFactoryName">
>             <value>factory</value>
>         </property>
>         <property name="relativePath">
>             <value>/mocca/contact</value>
>         </property>
>         <property name="remoteMethodNames">
>             <value>get*</value>
>         </property>
>     </bean>
>
>
> {webroot}/Application.cfc
> {webroot}/index.cfm (with swf)
>
> In Application.cfc onApplicationStart:
>
> <!--- setup coldspring bean factory --->
>         <cfset defaultProperties = structNew()/>
>         <cfset defaultProperties.dsn = 'mocca'/>
>         <cfset application.factory = createObject("component","
> coldspring.beans.DefaultXmlBeanFactory
> ").init(defaultProperties=defaultProperties)/>
>         <cfset application.factory.loadBeansFromXmlFile
> (expandPath("/mocca/app/config/services.xml"),true)/>
>         <cfset application.factory.getBean("contactService_remote") />
>
> Than in Flex I call:
>
> <mx:RemoteObject id="contactService" destination="ColdFusion" source="
> mocca.contact.contactServiceRemote" fault="serverFault(event)">
>         <mx:method name="getContacts"
> result="getContactsRO_handler(event)"    />
>     </mx:RemoteObject>
>
> I provided a beanFactoryName 'factory', assigned the beanfactory under
> this name to the application scope on start up, but it's till not available
> in contactServiceRemote (which was generated nicely by coldspring during
> application start.
>
> Thanks for hints, Daniel
>
>
>
>
>

Reply via email to