CF9 and Mach-ii properties bleed over

I recently upgraded from ColdFusion 8 to ColdFusion 9 on my development system, along with a fresh copy of Mach-ii 1.8.  Being a development server I had numerous project using some sort of framework.  As most developers do I load my frameworks into a common folder and have those mapped via the ColdFusion server. I also used generic mappings to my model, properties etc.  After upgrading to CF9, the first sites I visited would load fine with no problems what so ever.  But  when I loaded any subsequent sites, it appeared to pull all the generic mapped properties of the first site instead of pulling the properties the requested site.

Come to find out that CF9 changed the way it computes the hash for their cache key for CFCs. This can cause the server to get confused about which CFC you are asking for.  To combat this issue I had to create an app specific mapping in my Application.cfc.

 <cfcomponent  displayname="MyApplication"  extends="MachII.mach-ii">
     <cfset this.loginStorage = "session" />
     <cfset this.sessionManagement = true />
     <cfset this.setClientCookies = true />
     <cfset this.setDomainCookies = false />
     <cfset this.sessionTimeOut = CreateTimeSpan(0,0,30,0) />
     <cfset this.mappings["/MyApplication"] = GetDirectoryFromPath( GetCurrentTemplatePath() ) />

Once I got that setup I just added the “MyApplication” to the dot notation in my properties and listener declarations in my Mach-ii configuration file, like so:

     <!-- Application properties formerly placed in the Application.cfc -->
     <property name="applicationProperty" type="" />
     <property name="sessionProperty" type="" />
 <!-- LISTENERS -->
     <listener name="actionLogListener" type="MyApplication.model.actionLog.actionLogListener" />
     <listener name="newsListener" type="" />

Leave a Reply