One More Error

0 views
Skip to first unread message

Aaron Roberson

unread,
Mar 1, 2007, 4:02:20 PM3/1/07
to lightwire...@googlegroups.com
Peter,

I am getting an error that I cannot decipher. It says the parameter
value TRANSFER to function INIT is required and has not been passed
in. However, (a) It does not say which function is requiring Transfer
to be passed in and (2) it should be passed in by lightwire
automagically.

See this link for the error:
http://www.pasteserver.net/322

And see the code below for the LightWire config settings:

variables.Bean.transferFactory.Singleton = 1;
variables.Bean.transferFactory.Path = "transfer.transferFactory";
variables.Bean.transferFactory.ConstructorProperties.datasourcePath =
"/#application.name#/config/datasource.xml";
variables.Bean.transferFactory.ConstructorProperties.configPath =
"/#application.name#/config/transfer.xml";
variables.Bean.transferFactory.ConstructorProperties.definitionPath =
"/#application.name#/com/transfer/definitions";

// User service
variables.Bean.userService.Singleton = 1;
variables.Bean.userService.Path = "#application.name#.com.user.userService";
variables.Bean.userService.ConstructorDependencies = "transferFactory";
variables.Bean.userService.SetterDependencies = "userGateway";


Thanks for your help, I really appreciate it!

Peter Bell

unread,
Mar 1, 2007, 4:11:04 PM3/1/07
to lightwire...@googlegroups.com
Hi Aaron,

I get this error when I don't pass in a constructor argument or constructor
dependency. If you look in one of the objects you are calling, it will have
a cfargument in the init() method with a name of transfer (that is what is
causing the error). It is not necessarily Transfer. If you have put transfer
in your UserService as a constructor dependency, then it would be your
UserSevice throwing this error.

The fix would be to add variables.Bean.UserService.ConstructorDependencies =
"Transfer"; (assuming Transfer is an object not a property - which I'm
guessing is a correct assumption).

You need to put the constructordependencies for any bean that requires
objects to be passed into its init() method, so if ProductService and
MyOtherBean also require transfer, you'd also have to add the following to
your lightwire config:
variables.Bean.ProductService.ConstructorDependencies = "Transfer";
variables.Bean.MyOtherBean.ConstructorDependencies = "Transfer";

Any help?

Best Wishes,
Peter

Aaron Roberson

unread,
Mar 1, 2007, 4:16:12 PM3/1/07
to lightwire...@googlegroups.com
That is what I figured the error was saying but what you said to do is
exactly what I am already doing. See below:

Aaron Roberson

unread,
Mar 1, 2007, 4:23:44 PM3/1/07
to lightwire...@googlegroups.com
I think I may have massaged it out. It seems that the name of the
ConstructorDependencies value has to be the same as the object
parameter.

So I changed this:

> variables.Bean.transferFactory.Singleton = 1;
> variables.Bean.transferFactory.Path = "transfer.transferFactory";
> variables.Bean.transferFactory.ConstructorProperties.datasourcePath =
> "/#application.name#/config/datasource.xml";
> variables.Bean.transferFactory.ConstructorProperties.configPath =
> "/#application.name#/config/transfer.xml";
> variables.Bean.transferFactory.ConstructorProperties.definitionPath =
> "/#application.name#/com/transfer/definitions";
>

> // User service
> variables.Bean.userService.Singleton = 1;
> variables.Bean.userService.Path = "#application.name#.com.user.userService";
> variables.Bean.userService.ConstructorDependencies = "transferFactory";
> variables.Bean.userService.SetterDependencies = "userGateway";

To this:

// Transfer ORM
variables.Bean.transfer.Singleton = 1;
variables.Bean.transfer.Path = "transfer.transferFactory";
variables.Bean.transfer.ConstructorProperties.datasourcePath =
"/#application.name#/config/datasource.xml";
variables.Bean.transfer.ConstructorProperties.configPath =
"/#application.name#/config/transfer.xml";
variables.Bean.transfer.ConstructorProperties.definitionPath =
"/#application.name#/com/transfer/definitions";

// User service
variables.Bean.userService.Singleton = 1;
variables.Bean.userService.Path = "#application.name#.com.user.userService";

variables.Bean.userService.ConstructorDependencies = "transfer";
variables.Bean.userService.SetterDependencies = "userGateway";

Peter Bell

unread,
Mar 1, 2007, 4:28:42 PM3/1/07
to lightwire...@googlegroups.com
Hi Aaron,

Just a thought:

Error message:


It says the parameter
value TRANSFER to function INIT is required and has not been passed
in.

Config code:
>>> variables.Bean.userService.ConstructorDependencies = "transferFactory";

Sounds like you either need to change cfargument name to transferfactory or
change the name of the bean in LightWire config to Transfer.

Best Wishes,
Peter

Peter Bell

unread,
Mar 1, 2007, 4:39:47 PM3/1/07
to lightwire...@googlegroups.com
That is it exactly!

Wow, in addition to writing LightWire FAQs for transfer it looks like you're
going to at least know answers to all the possible FAQs on LightWire as well
by the time you're done!!!

Best Wishes,
Peter

Aaron Roberson

unread,
Mar 1, 2007, 4:46:13 PM3/1/07
to lightwire...@googlegroups.com
I already posted that same thing... ha,ha. But I would like to ask, do
you think you should have to do that? When passing arguments into an
object with many parameters, you can pass them in using
name-value-pairs or order-value-pairs. Either way, argument name and
the parameter name do not have to match.

-Aaron

Aaron Roberson

unread,
Mar 1, 2007, 4:48:51 PM3/1/07
to lightwire...@googlegroups.com
> Wow, in addition to writing LightWire FAQs for transfer it looks like you're
> going to at least know answers to all the possible FAQs on LightWire as well
> by the time you're done!!!

I'm glad that you are "impressed," Mark seems to think that I need to
show more initiative and is pretty much sick of hearing from me at
this point (though he is very cordial and does try to help).

-Aaron

Aaron Roberson

unread,
Mar 1, 2007, 4:51:45 PM3/1/07
to lightwire...@googlegroups.com
> I'm glad that you are "impressed," Mark seems to think that I need to
> show more initiative and is pretty much sick of hearing from me at
> this point (though he is very cordial and does try to help).

Oh, I should add that if I was Mark I would probably think the same
thing. I have asked him some pretty stupid questions. No bad feelings
toward Mark.

-Aaron

Peter Bell

unread,
Mar 1, 2007, 5:03:56 PM3/1/07
to lightwire...@googlegroups.com
Hi Aaron,

It is a fair question, but in LightWire, if you think about it, it need to
know what bean to pass in.

Right now it does:
ConstructorDependencies = "BeanName"

And then looks for the bean in variables.beans called
variables.beans.BeanName

I am very open to being able to pass in transferFactory as transfer, but
then you need to tell it that, so we get:
ConstructorDependencies.transfer = "transferFactory"

A little more typing, but not bad.

But what if you want to pass in BeanA, BeanB, BeanC and BeanD?

Right now you'd set
ConstructorDependencies = "BeanA,BeanB,BeanC,BeanD"

With the property value approach, you'd have to type:
ConstructorDependencies.NameA = "BeanA"
ConstructorDependencies.NameB = "BeanB"
ConstructorDependencies.NameC = "BeanC"
ConstructorDependencies.NameD = "BeanD"

So, question is how often is it true that NameX <> BeanX? If it is half the
time, this is worth changing. If it is 1 time in 10, maybe not so much.

Other option is to extend the list to allow an optional alias:
ConstructorDependencies = "BeanA,BeanB as NameB,BeanC,BeanD"

Or something similar - perhaps just a pipe to delimit the optional alias.
That would be fairly easy to implement. It'd be a little "magic charactery"
but *may* be worth it.

What would be the use cases for where argument name <> bean name, how often
do they come up and how should LightWire support them? Any preferences?

Best Wishes,
Peter

Peter Bell

unread,
Mar 1, 2007, 5:31:09 PM3/1/07
to Lightwire Framework
How about this as part of the config file:

addConstructorBean(BeanName string required, BeanAlias string
optional)

same for addSetterBean and addMixinBean. That way nice and clean and
easy optional alias support. Would that work?

> On 3/1/07 4:46 PM, "Aaron Roberson" <iisitedes...@gmail.com> wrote:
>
>
>
> > I already posted that same thing... ha,ha. But I would like to ask, do
> > you think you should have to do that? When passing arguments into an
> > object with many parameters, you can pass them in using
> > name-value-pairs or order-value-pairs. Either way, argument name and
> > the parameter name do not have to match.
>
> > -Aaron
>

Aaron Roberson

unread,
Mar 1, 2007, 5:51:07 PM3/1/07
to lightwire...@googlegroups.com
Why can't it just be name-value-pair or position-value-pair. Couldn't
LightWire figure it out based on that, just like every other component
does? I don't get it.

if (argument position = 1){send to first parameter}
if (argument position = 2){send to second parameter}

or

right(arg, "=") send to left(arg, "=")

-Aaron

Peter Bell

unread,
Mar 1, 2007, 6:11:37 PM3/1/07
to lightwire...@googlegroups.com
Sure it can. But what would be the exat syntax you'd propose for the config
bean?

Lets say you have three beans - BeanA, BeanB and BeanC
They should be passed to UserService as BeanA, NewNameForB and BeanC

What exactly would you want to type in the config bean to tell it that
UserService needed those three?

I'm proposing:
addConstructorBean("BeanA");
addConstructorBean("BeanB", "NewNameForB");
addConstructorBean("BeanC");

OR something like
setConstructorBeanList("BeanA,BeanB:NewNameForB,BeanC");

Thoughts? Preferences? I'm tempted to support both . . . ?

Aaron Roberson

unread,
Mar 1, 2007, 6:24:03 PM3/1/07
to lightwire...@googlegroups.com
How about just
setConstructorDependencies("BeanA","BeanB","BeanC");
or
setConstructorDependencies(Bean1="BeanA",Bean2="BeanB",Bean3="BeanC");

And the receiving object could have:
<cfargument name="Bean1" type="path.to.Bean1">
<cfargument name="Bean2" type="path.to.Bean2">
<cfargument name="Bean3" type="path.to.Bean3">

You shouldn't have to know what the name of parameter is that you are
passing the argument to. It should be encapsulated. "BeanA" should
just map to "Bean1" because it is being passed in by name-value-pair
or position-value-pair. That would be consistent with every other
language including ColdFusion.

Reply all
Reply to author
Forward
0 new messages