Could not find object method in ColdFusion...
Posted on 2012-03-29
I have an instance of a ColdFusion object created and stored in session scope the first time during user's session start and persists over the lifespan of the session (See code below). The problem is that every time I introduce a new method to the component and deploy the method to Production, my users are receiving the error "Could not find method 'getProductInfo'..." This is because the users' session still persists and therefore all the methods and properties of the object are still referring to instance of object in the session that was created right before code deployment.
<cfparam name="session.myObject" default="#createObject('component','myComponents.Products').init(request.someVariable)#">
<cfset variables.result = session.myObject.getProductInfo(request.CustomerID)>
How do I prevent/resolve this problem?
NOTE: I could have used local variable to store the object, but I don't want to do that because doing so would require the object to be created on every page load. And I don't want to store the object in application variable neither as it presents other problems.
I'm using CF 8.
Many thanks in advance.