7 Replies Latest reply on Apr 3, 2009 11:58 AM by SmilingRoses

    ColdFusion not finding cfc's

    SmilingRoses Level 1
      My problem is this. I have created a website using flex, coldfusion, and mysql. The website looks fine and the connections to the database work and all is well until I do a release build, and then try to access the website. (the website is on an Apache server) The website url is www.tropicallawnandgarden.net

      When you go to the website you see ColdFusion errors. Unable to invoke CFC - Could not find the ColdFusion Component or Interface ProjectFolder.src.cfc.ClientsGateway faultDetail:'Ensure that the name is correct and that the component or interface exists.

      Why is coldfusion looking for the cfc's in the project folder? Why isn't it finding the cfc's in the release build folder?

      I added a mapping in the coldfusion administrator to the release build folder, but that didn't seem to make any difference.

      I really would appreciate any help with this.
        • 1. Re: ColdFusion not finding cfc's
          Level 7
          > When you go to the website you see ColdFusion errors. Unable to invoke CFC -
          > Could not find the ColdFusion Component or Interface
          > ProjectFolder.src.cfc.ClientsGateway faultDetail:'Ensure that the name is
          > correct and that the component or interface exists.
          >
          > Why is coldfusion looking for the cfc's in the project folder? Why isn't it
          > finding the cfc's in the release build folder?

          It'll be looking where the calling code tells it to. If it's looking in
          ProjectFolder.src.cfc.ClientsGateway, it suggests you have this sort of
          thing:

          myObj = createObject("component", "ProjectFolder.src.cfc.ClientsGateway");

          (or <cfobject>, <cfinvoke> or what-have-you).

          What's the calling code that's generating that error?

          --
          Adam
          • 2. Re: ColdFusion not finding cfc's
            SmilingRoses Level 1

            Below is the ClientsDAO (partial code) that shows the createObject section that you mention and the ClientsGateway (partial code)

            I'm not sure what you mean by what is the calling code that's generating that error. The title of the error box is Server.Processing if that is what you mean.

            When you go to the website it gives me the same error 4 times then changes to say it can't find SerivceGateway, then when you say OK, it gives the can't find ClientsGateway error once more. Hit OK and the website is shown, but the connection to the database doesn't work.

            CLIENTSDAO.cfc
            <cfcomponent output="false">

            <cffunction name="read" output="false" access="public" returntype="Darren21.src.cfc.Clients">
            <cfargument name="id" required="true">
            <cfset var qRead="">
            <cfset var obj="">

            <cfquery name="qRead" datasource="barbosa">
            select clientID, fname, lname, address, city, state,
            zip, hPhone, cPhone, email, pass,
            comments, startDate, rate, ts

            from bclients
            where clientID = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#arguments.id#" />
            </cfquery>

            <cfscript>
            obj = createObject("component", "Darren21.src.cfc.Clients").init();
            obj.setclientID(qRead.clientID);
            obj.setfname(qRead.fname);
            obj.setlname(qRead.lname);
            obj.setaddress(qRead.address);
            obj.setcity(qRead.city);
            obj.setstate(qRead.state);
            obj.setzip(qRead.zip);
            obj.sethPhone(qRead.hPhone);
            obj.setcPhone(qRead.cPhone);
            obj.setemail(qRead.email);
            obj.setpass(qRead.pass);
            obj.setcomments(qRead.comments);
            obj.setstartDate(qRead.startDate);
            obj.setrate(qRead.rate);
            obj.setts(qRead.ts);
            return obj;
            </cfscript>
            </cffunction>



            <cffunction name="create" output="false" access="public">
            <cfargument name="bean" required="true" type="Darren21.src.cfc.Clients">
            <cfset var qCreate="">

            <cfset var qGetId="">

            <cfset var local1=arguments.bean.getfname()>
            <cfset var local2=arguments.bean.getlname()>
            <cfset var local3=arguments.bean.getaddress()>
            <cfset var local4=arguments.bean.getcity()>
            <cfset var local5=arguments.bean.getstate()>
            <cfset var local6=arguments.bean.getzip()>
            <cfset var local7=arguments.bean.gethPhone()>
            <cfset var local8=arguments.bean.getcPhone()>
            <cfset var local9=arguments.bean.getemail()>
            <cfset var local10=arguments.bean.getpass()>
            <cfset var local11=arguments.bean.getcomments()>
            <cfset var local12=arguments.bean.getstartDate()>
            <cfset var local13=arguments.bean.getrate()>
            <cfset var local15=arguments.bean.getts()>

            <cftransaction isolation="read_committed">
            <cfquery name="qCreate" datasource="barbosa">
            insert into bclients(fname, lname, address, city, state, zip, hPhone, cPhone, email, pass, comments, startDate, rate, ts)
            values (
            <cfqueryparam value="#local1#" cfsqltype="CF_SQL_VARCHAR" />,
            <cfqueryparam value="#local2#" cfsqltype="CF_SQL_VARCHAR" />,
            <cfqueryparam value="#local3#" cfsqltype="CF_SQL_VARCHAR" />,
            <cfqueryparam value="#local4#" cfsqltype="CF_SQL_VARCHAR" />,
            <cfqueryparam value="#local5#" cfsqltype="CF_SQL_CHAR" />,
            <cfqueryparam value="#local6#" cfsqltype="CF_SQL_CHAR" />,
            <cfqueryparam value="#local7#" cfsqltype="CF_SQL_CHAR" />,
            <cfqueryparam value="#local8#" cfsqltype="CF_SQL_CHAR" />,
            <cfqueryparam value="#local9#" cfsqltype="CF_SQL_VARCHAR" />,
            <cfqueryparam value="#local10#" cfsqltype="CF_SQL_VARCHAR" />,
            <cfqueryparam value="#local11#" cfsqltype="CF_SQL_LONGVARCHAR" />,
            <cfqueryparam value="#local12#" cfsqltype="CF_SQL_TIMESTAMP" null="#iif((local12 eq ""), de("yes"), de("no"))#" />,
            <cfqueryparam value="#local13#" cfsqltype="CF_SQL_INTEGER" null="#iif((local13 eq ""), de("yes"), de("no"))#" />,
            <cfqueryparam value="#local15#" cfsqltype="CF_SQL_TIMESTAMP" null="#iif((local15 eq ""), de("yes"), de("no"))#" />
            )
            </cfquery>

            <!--- If your server has a better way to get the ID that is more reliable, use that instead --->
            <cfquery name="qGetID" datasource="barbosa">
            select last_insert_id() as clientID
            from bclients
            order by clientID desc
            </cfquery>
            </cftransaction>

            <cfscript>
            arguments.bean.setclientID(qGetID.clientID);
            </cfscript>
            <cfreturn arguments.bean />
            </cffunction>

            CLIENTSGATEWAY.cfc

            <cfcomponent output="false">
            <cffunction name="getById" output="false" access="remote">
            <cfargument name="id" required="true" />
            <cfreturn createObject("component", "ClientsDAO").read(arguments.id)>
            </cffunction>


            <cffunction name="save" output="false" access="remote">
            <cfargument name="obj" required="true" />
            <cfscript>
            if( obj.getclientID() eq 0 )
            {
            return createObject("component", "ClientsDAO").create(arguments.obj);
            } else {
            return createObject("component", "ClientsDAO").update(arguments.obj);
            }
            </cfscript>
            </cffunction>

            <cffunction name="deleteById" output="false" access="remote">
            <cfargument name="id" required="true" />
            <cfset var obj = getById(arguments.id)>
            <cfset createObject("component", "ClientsDAO").delete(obj)>
            </cffunction>

            <cffunction name="getAll" output="false" access="remote" returntype="Darren21.src.cfc.Clients[]">
            <cfset var qRead="">
            <cfset var obj="">
            <cfset var ret=arrayNew(1)>

            <cfquery name="qRead" datasource="barbosa">
            select clientID
            from bclients
            </cfquery>

            <cfloop query="qRead">
            <cfscript>
            obj = createObject("component", "ClientsDAO").read(qRead.clientID);

            ArrayAppend(ret, obj);
            </cfscript>
            </cfloop>
            <cfreturn ret>
            </cffunction>

            <cffunction name="getAllAsQuery" output="false" access="remote" returntype="query">
            <cfargument name="fieldlist" default="*" hint="List of columns to be returned in the query.">

            <cfset var qRead="">

            <cfquery name="qRead" datasource="barbosa">
            select #arguments.fieldList#
            from bclients
            </cfquery>

            <cfreturn qRead>
            </cffunction>

            • 3. Re: ColdFusion not finding cfc's
              Level 7
              SmilingRoses wrote:
              > My problem is this. I have created a website using flex, coldfusion, and mysql.
              > The website looks fine and the connections to the database work and all is well
              > until I do a release build, and then try to access the website. (the website is
              > on an Apache server) The website url is www.tropicallawnandgarden.net
              >
              > When you go to the website you see ColdFusion errors. Unable to invoke CFC -
              > Could not find the ColdFusion Component or Interface
              > ProjectFolder.src.cfc.ClientsGateway faultDetail:'Ensure that the name is
              > correct and that the component or interface exists.
              >
              > Why is coldfusion looking for the cfc's in the project folder? Why isn't it
              > finding the cfc's in the release build folder?

              Mostly like because that's where you told him to look: the cfc that is
              called is configured by the src attribute of the RemoteObject mxml tag.

              > I added a mapping in the coldfusion administrator to the release build folder,
              > but that didn't seem to make any difference.

              It's not a CF error, the path to the CFC is wrong in the mxml file (it's
              not the correct path for the release build).

              --
              Mack
              • 4. Re: ColdFusion not finding cfc's
                SmilingRoses Level 1
                Oh, but it is. Look. That's why this has me so confused.

                <mx:RemoteObject id="clientFormRO" destination="ColdFusion"
                source="Darren21.src.cfc.ClientsGateway">
                <mx:method name="oneClient" result="oneClientHandler(event)"
                fault="faultHandler(event)"/>
                </mx:RemoteObject>

                <mx:RemoteObject id="sro" destination="ColdFusion"
                source="Darren21.src.cfc.ServiceGateway">
                <mx:method name="getService" result="getServiceResult(event)"
                fault="fault(event)"/>
                • 5. Re: ColdFusion not finding cfc's
                  Level 7
                  SmilingRoses wrote:
                  > Oh, but it is. Look. That's why this has me so confused.
                  >
                  > <mx:RemoteObject id="clientFormRO" destination="ColdFusion"
                  > source="Darren21.src.cfc.ClientsGateway">
                  > <mx:method name="oneClient" result="oneClientHandler(event)"
                  > fault="faultHandler(event)"/>
                  > </mx:RemoteObject>

                  And the file #web_root#/Darren21/src/cfc/ClientsGateway.cfc exists ?
                  (hint:
                  http://www.tropicallawnandgarden.net/Darren21/src/cfc/ClientsGateway.cfc)

                  --
                  Mack
                  • 6. Re: ColdFusion not finding cfc's
                    SmilingRoses Level 1
                    I did my release build to another folder #web_root#/TLG and the cfc folder is under the TLG folder

                    #web_root#/TLG/cfc/ClientsGateway.cfc
                    • 7. Re: ColdFusion not finding cfc's
                      SmilingRoses Level 1
                      Given the direction of the questioning here I copied and pasted my project folder to the TLG folder and all seems to work now.

                      My question now is why does the release build have a cfc folder with my cfc's in it if that is not going to be used? It's great that things are working now, but I am still confused by the process. I thought that the release build would transfer everything that it needed without me having to do an extra step of copying the project folder as well.

                      Thank you for guiding me. I'm not sure I would have figured this one out on my own.