Error in AutoWiring

I have an issue that I can’t seem to fix, when autowiring a service I am getting the following error

Application Execution Exception

Error Type: Autowire.AutowireException : [N/A]
Error Messages: Error autowiring system.controllers.member. Element ADVERTISERNAME is undefined in ARGUMENTS.
coldfusion.runtime.UndefinedElementException: Element ADVERTISERNAME is undefined in ARGUMENTS. at coldfusion.runtime.CfJspPage.resolveCanonicalName(CfJspPage.java:1724) at coldfusion.runtime.CfJspPage._resolve(CfJspPage.java:1620) at coldfusion.runtime.CfJspPage._resolveAndAutoscalarize(CfJspPage.java:1794) at coldfusion.runtime.CfJspPage._resolveAndAutoscalarize(CfJspPage.java:1787) at cfvotesService2ecfc165185182.runPage(E:\projects\ColdFusion\AustralianBridalDirectory\wwwroot\system\model\votesService.cfc:83) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231) at coldfusion.runtime.TemplateProxyFactory.resolveComponentHelper(Template

The code that is failing here is a private method that is defined like this.

//------------------------------------------------------------------------------------------------

//------------------------------------------------------------------------------------------------

private int function getAdvertiserId(required string advertiserName=’’, required string CompanyCode) {

var advertiser = ORMService.findWhere(entityName=‘Advertisers’, criteria = {AdvertiserName = arguments.advertiserName, CompanyCode = arguments.CompanyCode});

return advertiser.getAdvertisersId();

}

I am curious why this function is being called, it is only called from within the Service to begin with and it is also wrapped with a try/catch and transaction, but it is not hitting that code as it is an autowire problem.

Question is why is this happening?

Regards,

Andrew Scott

If I recall correctly, there is a bug in CF with implicit Structs in arguments sometimes.

Change criteria = {AdvertiserName = arguments.advertiserName, CompanyCode = arguments.CompanyCode}

var params = {AdvertiserName = arguments.advertiserName, CompanyCode = arguments.CompanyCode};

var advertiser = ORMService.findWhere(entityName=‘Advertisers’, criteria = params);

And see if that works. I know it seems unrelated, so if I’m wrong, I apologize, but I remember banging my head against something similar once.

Curt

Curt,

This actually works when the database has data in it, but when the database is blank this is what I get. I have 2 servers running this code, one has the staging data, and the other has a blank database. And it is the one with the blank database that is causing the error.

Aside from that you should really read the error, it actually says that it doesn’t exist in arguments.

The error you are talking about is another totally different error altogether and as far as I can tell it is it only applies to CF 9.0, not CF9.01 fully patched.

But if you also read my post, the question is as it is a private method why is AutoWiring running it? That is the question and will be a path to the solution as well.

Regards,

Andrew Scott

As I stated, I know its unrelated.

What happens on init, what are you autowiring in and how (properties, constructor args, etc)? How are you calling this cfc?

Curt

I am not calling it, this is an AutoWire problem.

And there is not init, so I will ask again why is a private method being called. This method is called once and only once from within the component, and that method is not even being called.

How do I know that because I have a writeDump(); abort; right before it is called.

Curt please don’t take this the wrong way, but the error message is very clear this is being called from being autowired by the CB and WireBox framework. Which means that there is once the application is initialised no calls from my code being called yet.

I understand that, but in order to properly know why the method could be called, I was hoping for some more information about what is being wired into this cfc and how.

Until you provide more information, I really can’t tell you why the “private” method is being called.

Curt

Curt,

This CFC is being wired into something else.

So I take it nobody knows why this is happening then?

Luis I could really use your help here, and explain to me why a private method is being called on when this component is being injected into a service.

Have you enabled logging for the ioc package? Enable it to get more debug info.

Curt,

Thought you would like to know you are right, I looked at the differences between the 2 CF Servers in greater detail, and found that the HotFix had not been applied like I thought it had.

I saw the version number was the same, and didn’t bother going any further.

So in short, that was exactly what the problem is, or should I say was.

Cheers Luis, just posted an update.