1

I was charged with making some modification to an old application, and I created a new page which was being passed a URL parameter page_name, which is a you guessed it a name of a page with .cfm appended. So, in my haste, I continued using it, and was building out my CFC and using the page_name as the identifier for a record. Then I realized that there is a possibility of that name being duplicated in the table, and changed that url parameter to use the page_id, which is unique. I modified my CFC to use the new key, and nothing worked. So I started going through my code and figured I made a typo, started commenting things out, and finally dumped out my CFC object and voila, none of the edits I made were actually being used. This was fairly obvious, since page_name was a string, and page_id was numeric.

So I started googling,The first thing I saw as adjust things in the CFAdmin. I don't have access to it, and restarting the server isn't an option since I'm using an RDS to live code. The next thing I tried was to add applicationStop(), onApplicationStart(), to my Application.cfc. Well the problem is that the Application.cfc, is actually an Application.cfm. So after fiddling with the <cfapplication ... > tag, and nothing being updated, I'm here asking for help.

So is there a quick fix for this? Should I go ahead and create an application.cfc? I hope I explained myself, and sorry for all the text.

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Rob M
  • 1,007
  • 2
  • 17
  • 38
  • 2
    you should be able to change `application.name` to something new which would refresh the application – Matt Busche Nov 19 '13 at 20:37
  • 2
    Sounds like creating an Application.cfc has merit. Then you can easily call onApplicationStart() from onRequestStart() when you need to refresh application variables. – Dan Bracuk Nov 19 '13 at 20:44

2 Answers2

1

Confirm that your cfc is bound to either the session or application scope.

If it is, then you can rename the application in application.cfm and it will reset the object.

If your cfc is NOT bound to session or application scope, you have a cacheing issue. You need to go the the CF admin -> Server Settings -> Cache tab and uncheck component cache and possibly some others.

For further recommendations, ColdFusion Components Inheriting Functions Of Others

Community
  • 1
  • 1
James A Mohler
  • 11,060
  • 15
  • 46
  • 72
  • I changed the application name, and no dice. I don't have access to the CFADMIN, so I'll probably have to get an approval for that. – Rob M Nov 19 '13 at 20:48
  • 1
    Are you developing this app on a remote server? Probably not the best way to develop apps. You should develop locally and push final code to server - expecially when you do not have access to CF Admin. – Scott Stroz Nov 19 '13 at 20:53
  • 1
    @ScottStroz I know, but I have to work in the confines of my job. – Rob M Nov 19 '13 at 20:55
  • 1
    Your job should include following best practices for development. Coding on a remote server - especially if it is the 'production' server is fraught with danger. – Scott Stroz Nov 19 '13 at 21:04
1

Sounds like you have been painted into a corner. Last option IF you have access the the server it self and can get into the C:\ or whatever drive that ColdFusion have been installed on, you can just manually delete the generated Java Class files that the server is using that has the old code. When ColdFusion sees there is no Class file it will recompile the newly changed file and whoa black betty go bam-a-lam your changes will be in production.

For more information here is an posting you can read up on: http://kalyan-coldfusion.blogspot.com/2010/08/how-coldfusion-works-and-its-key.html

Cheers

BDavis
  • 196
  • 2