Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unexpected Error in CFMX7 but not CFMX6.1 2

Status
Not open for further replies.

Signit

MIS
Oct 17, 2003
114
0
0
US
In my application.cfm I load up a ColdFusion component for AD LDAP interaction. Loading the component in the below manner in CFMX6.1 causes no problems, but in CFMX7 gives this error:
The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.
Null Pointers are another name for undefined values.

My code:
Code:
119 : <!--- load an ldap cfc into application scope --->
120 : <cfif not structKeyExists(application, "isReady") or structKeyExists(url, "resetapp")>
121 :   <cfset application.ldapCFC = CreateObject("component","templates.components.ldap_ad").init()>
122 :   <cfset application.isReady = true>
123 : </cfif>

It specifically indicates that line 121 is to blame. Any help would be appreciated.
 
What version of cf 7 or 7.01? If 7 do you have all the hoftixes installed?

If you try to instantiate the cfc and then call the init does that make a difference?

Code:
<cfset application.ldapCFC = CreateObject("component","templates.components.ldap_ad")>

<cfset application.ldapCFC.init() />
 
CFMX7 does not do automatic scope locking the way MX did. anytime you are referencing shared variables in MX7 you need to wrap them with CFLOCK


=========================================
I have not failed. I've just found 10,000 ways that won't work.
Thomas A. Edison
 
I am using MX7.0.1 with hotfix 2 in place. I've changed my code to:

Code:
119 : <!--- load an ldap cfc into application scope ---> 120 : <cfif not structKeyExists(application, "isReady") or structKeyExists(url, "resetapp")>
121 :   <cfset application.ldapCFC = CreateObject("component","templates.components.ldap_ad")>
122 :   <cfset application.ldapCFC.init()>
123 :   <cfset application.isReady = true>

Which threw the same error. I will attempt the cflock.
 
Is the error still on the same line? Just trying to isolate which line is throwing the error.

If its line 121 just as test trying changing the ldap cfc name in fact try changing all the names of the variables and cfcs just in case you have stumbled on some naming convention or reserved word which cfmx doesn't like. Finally move the cfc locally so you dont need to have the qualified package name and just call it directly:

Code:
<cfset application.ldapCFC = CreateObject("component","ldap_ad")>

As an aside, to avoid using the lock you can also use Application.cfc. If you do decide to add a lock make sure you do not single thread your application and use double checked locking.

 
Yes the error is still on line 121. And is the same:

The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.

Null Pointers are another name for undefined values.

This code is in application.cfm already so is the cflock unnecessary?
 
locking is still necessary on application.cfm, can't hurt to try it out to see if it solves the issue- if you want to resort to other methods later at least you will have isolated what is causing the problem.


=========================================
I have not failed. I've just found 10,000 ways that won't work.
Thomas A. Edison
 
Did you try changing all the variable names? Also have you checked the obvious things - are application variables actually enabled in the administrator? Do you have a cfapplication tag?
 
Back at work now. I had a thought over the weekend and it seems to have fixed the problem.

In MX6.1 this line works:
Code:
<cfset application.ldapCFC = CreateObject("component","templates.components.ldap_ad")>

In MX7.01 this line works:
Code:
<cfset application.ldapCFC = CreateObject("component","components.ldap_ad")>

The subtle difference is in the second parameter passed:
Code:
"templates.components.ldap_ad" vs. "components.ldap_ad".

The directory structure on the two boxes is identical. If it something that I have missed in my code I would gladly change it, but I think it is a ColdFusion change. I don't know why this change would have been made to CFC instantiation but it certainly is annoying. Anymore thoughts?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top