Skip to main content
Participant
May 4, 2020
Answered

cfobject en Application.cfc

  • May 4, 2020
  • 3 replies
  • 1694 views

necesita declarar cfobject en Application.cfc, pero me da el siguiente error:

en Application.cfc defino de la siguiente forma:

<cfobject component="geti_des.proc.dominioAD" name="dominioAD">

    This topic has been closed for replies.
    Correct answer BKBK

    You should in fact move from Application.cfm to Application.cfc. In any case, that has nothing to do with the error.

     

    Is the component path /geti_des/proc.dominioAD.cfc valid? Try the following:

     

    <cfif fileExists(expandPath("/geti_des/proc/dominioAD.cfc"))>
        <cfinvoke component="geti_des.proc.dominioAD" method="consDominioAD" returnvariable="qDominioAD">
    <cfelse>
    Componente no encontrado en esta ruta.
    </cfif>

     

    3 replies

    Participant
    May 5, 2020

    Gracias, hice la prueba de esa forma pero sigue dando el mismo error;
    Si ese mismo código lo utilizo en un Application.cfm si me funciona

    <cfobject component="geti_des.proc.dominioAD" name="dominioAD">

    Y el llamado lo realizó de esta forma:

    <cfinvoke component="#dominioAD#" method="consDominioAD" returnvariable="qDominioAD">

    Pero lo que quiero es pasar todo a un Application.cfc

    BKBK
    Community Expert
    BKBKCommunity ExpertCorrect answer
    Community Expert
    May 5, 2020

    You should in fact move from Application.cfm to Application.cfc. In any case, that has nothing to do with the error.

     

    Is the component path /geti_des/proc.dominioAD.cfc valid? Try the following:

     

    <cfif fileExists(expandPath("/geti_des/proc/dominioAD.cfc"))>
        <cfinvoke component="geti_des.proc.dominioAD" method="consDominioAD" returnvariable="qDominioAD">
    <cfelse>
    Componente no encontrado en esta ruta.
    </cfif>

     

    Participant
    May 5, 2020

    Según la validación, la ruta del componente si es válida 

    BKBK
    Community Expert
    Community Expert
    May 5, 2020

    Apparently, you want the object dominioAD to be available throughout the application. Hence, across every request and every session and irrespective of the component path.

    If so, then use:

     

    <!--- In Application.cfc --->
    <cfobject component="geti_des.proc.dominioAD" name="application.dominioAD">
    
    <!--- On the CFM page --->
    <cfinvoke component="#application.dominioAD#" method="consDominioAD" returnvariable="qDominioAD">
    
    
    WolfShade
    Legend
    May 5, 2020

    I'm not allowed to delete this.  I keep coming up with questions, but then re-read your post and they get answered.

     

    If the code you provided from within your application.cfc is as it currently exists, you're missing equal signs.  If not, I'm not sure what to do.

     

    V/r,

     

    ^ _ ^