0

I have been using a basic Application.cfc file (below) that stopped working when the server was upgraded from ColdFusion 11 to ColdFusion 2016. I have tried the following and several variations on it but cannot get it to work. This is what worked on ColdFusion F11 but won't work on ColdFusion 2016. I am stumped. What am I missing?

<cfcomponent>
    <cfscript>
        this.datasource = "myDSN";
        this.sessionManagement = "Yes";
        this.sessionTimeout = CreateTimeSpan(0,0,20,0);
        this.setClientCookies = "Yes";
        this.clientmanagement="Yes";
        this.domain="www.mydomain.com";
    </cfscript>

    <cffunction name="onRequestStart">
        <cfargument name="requesturi" required="true">
    </cffunction>

    <cftry>
        <cfcatch type="database" >
            <cflocation url="err_exception.cfm">
        </cfcatch> 
    </cftry>

    <cffunction name="onError" returnType="void" output="true">
        <cfargument name="exception" required="true">
        <cfargument name="eventname" type="string" required="true">
        <cfset var errortext = "">
        <cfsavecontent variable="errortext">
            <cfoutput>
            <strong>Template</strong>:                 http://#cgi.server_name##cgi.script_name#?#cgi.query_string#<br />
            <strong>Error</strong>: #arguments.exception.message#<br />
            </cfoutput>
        </cfsavecontent>
        <cfmail to="techsupport@suchandsuch.com"     from="techsupport@suchandsuch.com" subject="From Local Srvr - Error at     mydomain Website">
            #errortext#
        </cfmail>
        <strong>Error Details:</strong>
        <cfoutput>#errortext#</cfoutput> 
    </cffunction>
</cfcomponent>

AND A SIMPLE QUERY

<cfquery name="GetVendor">
    select *
    from empinfotbl
</cfquery>
<cfoutput query="GetVendor">
    #LastName#, #FirstName#<br>
</cfoutput>

Error was:

ERR_TOO_MANY_REDIRECTS

and after clearing cache, indicates:

Error Executing database query:

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Andy Ray
  • 1
  • 1
  • 3
    That does not appear to be a complete Application.cfc file. For example, the `` block is not within any defined function and it does nothing but check for a database error when there is nothing else within the cftry block? My suggestion would be to start with a very minimal Application.cfc file. Make sure that works. Then start adding little bits in until it breaks. Then fix that part and continue. – Miguel-F Nov 07 '19 at 13:04
  • 1
    Could you please give a name for your application ? like this.name = 'xyz'. Then update here about the results. Because Every application needs a name. It must be more or less alphanumeric and as a best practice, should not include spaces or any symbols or punctuation. This name is used to create different contexts for each application running on the server, so that they don't share any memory. Without a unique name, your application's code could potentially overwrite memory values for another application. – Kannan.P Nov 07 '19 at 13:57
  • Thank you for the feedback and sorry, I omitted a line in which the app name was defined right under the opening CFCOMPONENT and befpre the opening CFSCRIPT where the DSN, session info etc. are defined. Mea Culpa on that. I will check into the CFTRY block. and see what happens. The odd thing is that this file worked fine in CF10 and CF11 but "broke" when I moved it onto CF2016. – Andy Ray Nov 07 '19 at 18:47
  • What is the error? – Dan Roberts Nov 08 '19 at 21:19

0 Answers0