i am trying to call the component ```component imp...
# cfml-beginners
g
i am trying to call the component
Copy code
component implements="IStringsFactory" {
the implements is in the same folder as component
Copy code
interface {
    public ILocalizedStrings function getStrings(required string directory, required string defaultLocale);
}
i am getting an error
Could not find the ColdFusion component or interface com.IStringsFactory.
a
There is some information you are not giving us here. The code you include says your CFC is implementing
IStringFactory
, but the error is talking about
com.IStringFactory
. Those are two different things, and you don't show us where that
com.StringFactory
reference comes from.
g
It works in all versions except 2021 And even I created a mapping to fix it but still errors out
a
Right, good to know. But back to what I said...
<cfset Application.factory = new appcfc.com.StringsFactory()>
...
<http://appcfc.com|appcfc.com>
seems a rather odd package path too. And doesn't match the error message either.
g
I removed it and added a mapping it does connect mappings either
sorry, i have said: it does not connect either
starngly its not working only in cf2021 and it works even in lucee
a
Can't make any sensible comment about "I created a mapping", "I removed the mapping" without any knowledge of what the file system structure is, or what the mapping values were etc. As for not working on CF2021 and working elsewhere... it's likely a server config issue (if this code works at all anywhere else), so it probs more a case of it not working on that CF2021 server instance, rather than "it's something with CF2021". Still: I'd not be worrying about other ppl's work interfering with this, and I'd be sticking to yer own work and where it's wrong for now. Assume Lucee / CF / etc all work correctly is configured correctly, and it's your code or config that's off. That will help focus your efforts.
So that CFC you initially showed us. Is that at
/appcfc/com/StringsFactor.cfc
in the file system? Or are there mappings that resolve either
appcfc
or
<http://appcfc.com|appcfc.com>
? It would be really helpful if you could give us enough information to not have to guess all this stuff.
Or is that relative to the file you are calling the code in? (eg: you have
/var/www/yourapp/yourFile.cfm
, and then there's
/var/www/yourapp/appcfc/com/StringFactory.cfc
and
/var/www/yourapp/appcfc/com/IStringFactory.cfc
?