Skip to main content
Inspiring
May 16, 2008
Question

Invoking component from cffunction

  • May 16, 2008
  • 5 replies
  • 3024 views
Hi all,

I had a script in CF7 that used cfinvoke to call a cffunction from inside a different cffunction tag within the same cfcomponent tag. This all worked fine on my old CF7 server, but now on a new CF8 server it throws an error saying "Could not find the ColdFusion Component or Interface CFC.shoppingCart."

Any ideas anyone?

Thanks, Paul

    This topic has been closed for replies.

    5 replies

    BKBK
    Community Expert
    Community Expert
    May 17, 2008
    All's well that ends well.




    BKBK
    Community Expert
    Community Expert
    May 17, 2008
    Could there be a name/type clash? What happens when you give the function a new name?

    Inspiring
    May 17, 2008
    > I have recently changed the returned variable name as it was the same as the
    > calling function and having tested in a different browser, it seems to work now.

    > I suspect that was the cause from the beginning - I never had that problem
    > with CF7.1 though. Something new in CF8?

    Definitely not something new.

    I suspect something else has changed in the environment that you either
    don't know about or don't htink is relevant so didn't tell us.

    Still: it works now, which is the main thing :-)

    --
    Adam
    BKBK
    Community Expert
    Community Expert
    May 17, 2008
    If you get the same error, then you're calling the function from a page relative to which the CFC's path is different from CFC.shoppingCart. There are three paths to consider. What is the path of the shoppingCart CFC, of the page containing the function and of the page that calls the function?

    Inspiring
    May 17, 2008
    BKBK,

    The calling page is mysite.com/page.cfm and it calls the cfc as cfc.shoppingCart.
    The shoppingCart cfc is mysite.com/cfc/shoppingCart.cfc

    The error it gives is Entity has incorrect type for being called as a function.

    Thanks,
    Paul
    Inspiring
    May 16, 2008
    Trying to get a shared hosting provider to restart a service on their boxes can be quite a frustrating task. If for some reason you can't test the application on a local development machine, you could always just change the name of the CFC and test against the new CFC. You shouldn't have any problems with coldfusion pointing to an old version of the component.
    Inspiring
    May 16, 2008
    > "Could not find the ColdFusion Component or Interface CFC.shoppingCart."

    > <cfinvoke component="CFC.shoppingCart" method="getCartProduct"
    > returnvariable="getCartProduct">


    Can you browse to http://yoursite/CFC/shoppingCart.cfc?

    Do you have a CF mapping called CFC, pointing to the dir that has
    shoppingCart.cfc in it?

    CF needs to know how to find the CFC file.


    --
    Adam
    Inspiring
    May 16, 2008
    Thanks for your reply Adam,

    I can browse to http://yoursite/CFC/shoppingCart.cfc, but it shows an empty page.

    I do not have a CF mapping called CFC, pointing to the dir that has shoppingCart.cfc in it, nor did I have on the old server.

    There are various other functions within the site that use functions from this cfc without issue, but it seems to fall down at the point where a cffunction uses cfinvoke to call another cffunction in the same cfcomponent.

    Thanks,
    Paul