What happens if you change type="string" to type="any"? Just to test..

 

---

James  Allen

E: [email protected]

Blog: http://jamesallen.name

Twitter: @CFJamesAllen (Coldfusion / Web development)

Twitter: @jamesallenuk (General)

Twitter: @JamesAllenVoice (Voiceover)

 

From: [email protected] [mailto:[email protected]] On
Behalf Of Nathan Stanford II
Sent: 24 January 2011 19:34
To: [email protected]
Subject: Re: [Model-Glue] Datasource used across beans

 

Ok that makes sense. What is actually being returned is string...the DSN to
be exact. So I tried passing that but it is claiming it isn't a string.
Hmm..here is the updated code that I have now:

 

<cfargument name="dsn" type="string" required="true" />

<cfset variables.dsn = arguments.dsn />

 

Error message:



Bean creation exception during init() of model.layoutDAO

         

The DSN argument passed to the init function is not of type string.:If the
component name is specified as a type of this argument, it is possible that
either a definition file for the component cannot be found or is not
accessible.

 

Not sure what is going on here.


Nathan Stanford II






On Mon, Jan 24, 2011 at 2:22 PM, Dan Wilson <[email protected]> wrote:

If it were me, I'd try to find out what's being passed to the argument call?

 

What happens if you remove the strong type in the cfargument call and dump
the value of arguments?

 

Replace this:

<cfargument name="dsn" type="ModelGlue.Bean.CommonBeans.Datasource"
required="yes" />

<cfset variables.dsn = arguments.dsn.getDSN() />

 

With this:

 

<cfargument name="dsn" type="any" default="no" />
<cfdump var="#arguments#"> <cfabort>

 

 

 

 

On Mon, Jan 24, 2011 at 2:12 PM, Nathan Stanford II <[email protected]>
wrote:

Okay, so I really tried to find an answer about why this is happening
but to almost no avail. My problem is I want to have a datasource bean
that I can use on other beans. So I found a blog post by Todd Sharp
and really thought this was probably going to be my answer, but to no
avail. Here is the code I have:

<!-- Datasource bean -->
<bean id="datasource" class="ModelGlue.Bean.CommonBeans.Datasource"
singleton="true">
   <property name="dsn">
       <value>test</value>
   </property>
   <property name="Username">
       <value>username</value>
   </property>
   <property name="Password">
       <value>password</value>
   </property>
</bean>

<!-- Layout beans -->
       <bean id="layoutDAO" class="model.layoutDAO">
                       <constructor-arg name="dsn"><ref bean="datasource"
/></constructor-
arg>
       </bean>
       <bean id="layoutGateway" class="model.layoutGateway">
               <constructor-arg name="dsn"><ref bean="datasource"
/></constructor-
arg>
       </bean>
       <bean id="layoutService" class="model.layoutService">
               <constructor-arg name="dsn"><ref bean="datasource"
/></constructor-
arg>
               <constructor-arg name="layoutDAO">
                       <ref bean="layoutDAO"/>
               </constructor-arg>
               <constructor-arg name="layoutGateway">
                       <ref bean="layoutGateway"/>
               </constructor-arg>
       </bean>
Then in my cfcs I simply reference and set the dsn in my init method:

<cfargument name="dsn" type="ModelGlue.Bean.CommonBeans.Datasource"
required="yes" />

<cfset variables.dsn = arguments.dsn.getDSN() />

This is the error it keeps throwing:

Bean creation exception during init() of model.layoutService

The DSN argument passed to the init function is not of type
ModelGlue.Bean.CommonBeans.Datasource.:If the component name is
specified as a type of this argument, it is possible that either a
definition file for the component cannot be found or is not
accessible.

If anyone has any ideas on what could be wrong here it would be
greatly appreciated

--
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
<mailto:model-glue%[email protected]> 
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en





-- 
Plutarch - "The mind is not a vessel to be filled but a fire to be kindled."

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog
 
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
<mailto:model-glue%[email protected]> 
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

 

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog
 
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

Reply via email to