9 Replies Latest reply on Aug 7, 2014 8:52 AM by pennsyfan

    CF Mappings CF11 Dev Not Working

    pennsyfan

      I have an Application.cfc

       

      In the top I set the mappings as follows:

       

      this.mappings['/deptCFC']=ExpandPath('../cfc/');

       

      test cfm page

      <cfinclude template="/deptCFC/yourtest.cfm"><br>

       

      fails to include template which exist in the cfc directory as specified in the this.mappings

       

      if I set this in cfadmin then it works

       

      per-application settings is enabled in cfadmin

       

      i-7 32gb ram 2tb drive

      win 7 64bit

      eclipse juno 64 bit sr2

      cfb3 64 bit installed as plugin

      fb4.7 64 bit installed as plugin

        • 1. Re: CF Mappings CF11 Dev Not Working
          BKBK Adobe Community Professional & MVP

          It should work. Do you get an error message?

           

          To debug, run <cfoutput>#fileExists(expandPath('../cfc/yourtest.cfm'))#</cfoutput> in test.cfm, to verify whether the full path actually exists.

          • 2. Re: CF Mappings CF11 Dev Not Working
            pennsyfan Level 1

            I returns a value of YES

            • 3. Re: CF Mappings CF11 Dev Not Working
              pennsyfan Level 1

              Your debug code returns a value of YES.

               

               

               

              The error message is that the mapping does not work, i.e. unable to locate component or interface deptCFC/yourtest.cfm…

               

               

               

              Yet the cfdump shows the mapping struct and the path is correct.

              • 4. Re: CF Mappings CF11 Dev Not Working
                BKBK Adobe Community Professional & MVP

                Are you sure the file test.cfm is not including a second Application file? Test by temporarily copying Application.cfc to the same directory (assuming they are in different directories).

                 

                As a follow-up test, temporarily change the application's name (by changing the value of this.name in Application.cfc). This will force the application to restart.

                • 5. Re: Re: CF Mappings CF11 Dev Not Working
                  pennsyfan Level 1

                  Bk,

                   

                  There are only three files in this test project and they are pictured here:

                  MFT_Mapping_Test.PNG

                   

                  yourtest.cfm simply returns the current date time:

                  <cfoutput>Current Date Time Stamp: #now()#</cfoutput>

                  index.cfm contains a simple cfinclude:

                  <cfinclude template="/deptCFC/yourtest.cfm" >

                  Application.cfc is pretty simple straight forward with little code:

                  <cfcomponent displayname="ApplicationCFC" output="true" >

                  <cfscript>

                  this.name = "MyFireTouch_Mapping";

                  this.mappings['/deptCFC']=ExpandPath('../cfc/');

                  this.applicationTimeout = createTimeSpan(0,0,0,0);

                  this.sessionManagement = "false";

                  </cfscript>

                  <cfdump var="#this#">

                  <cffunction name="onApplicationStart" returntype="boolean" output="true">

                  <cfset application.dsn = "myfiretouchdb">

                  <cfset application.debugMode = 0>

                  <cfreturn true>

                  </cffunction>

                  <cffunction name="onRequestStart" returntype="boolean" output="false">

                  <cfargument name="thePage"type="string"required="true">

                  <cfif isDefined('url.reinit')>

                  <cfset onApplicationStart()>

                  </cfif>

                  <cfreturn true>

                  </cffunction>

                  </component>

                   

                  The applicaiton will reinitialize upon starting everytime so no need to change the name, but i have tried that part too.

                   

                  This is all the code there is, and it returns an error stating if cannot locate /deptCFC/yourtest.cfm but the dump of the mappings shows a full path to the correct directory:
                  MFT_Mapping_Test1.PNG

                   


                  • 6. Re: CF Mappings CF11 Dev Not Working
                    BKBK Adobe Community Professional & MVP

                    It just might be that the application falters or fails. Seeing the 0 timeout confirmed my instincts.

                     

                    So, let's rule one thing out, and at least avoid complications: give the application a non-zero timeout. For example, this.applicationTimeout = createTimeSpan(1,0,0,0);


                    P.S.: As a rule, the Application file should not be used for display. Hence, delete the cfdump.


                    • 7. Re: CF Mappings CF11 Dev Not Working
                      pennsyfan Level 1

                      BK,

                       

                       

                       

                      Giving the application a “non-zero” time out solved the issue.

                       

                       

                       

                      Thank You, I have been beating my head against the wall for a week now!

                       

                       

                       

                      Now to see if I can get the rest of the problems to go away, i.e. DSN not defined in APPLICATION etc.

                       

                       

                       

                      This error and others were all secondary to not being able to map to the cfc folder outside of the app root.

                       

                       

                       

                      Thanks

                       

                       

                       

                      Jim

                      • 8. Re: CF Mappings CF11 Dev Not Working
                        BKBK Adobe Community Professional & MVP

                        Glad to hear. Please kindly mark this as solved. It's the kind of issue to which someone else will be searching for an aswer in future.

                        • 9. Re: CF Mappings CF11 Dev Not Working
                          pennsyfan Level 1

                          BK,

                           

                          I have marked the timeoutspan as the correct answer for my problem thanks for the solution.

                           

                          Jim