Geo
Geo

Reputation: 3200

Element VAR is undefined in ATTRIBUTES ColdFusion 11

I am trying to call a method from a java class but I am getting an exception I haven't seen before.

This is what I get back when I am calling the class and one of the methods and how I got this

<cfdump var="#nlp#">
<cfdump var="#nlp.run()#">

enter image description here

And this is the exception I got when I am trying to dump the method

19:12:31.031 - Expression Exception - in Z:/Sites/xamplifier/views/surveyreporting/wordcloud.cfm : line 157
        Element VAR is undefined in ATTRIBUTES.

Am I calling the method in a wrong way? This is how we had the code on CF9 and everything works but CF 11 seems to have issues...

Upvotes: 2

Views: 676

Answers (2)

Troy S
Troy S

Reputation: 89

It looks like the Open_NPL run() method is generating an exception, which is caught and causes it to return null. See here: Open_NPS Source

Agree with the other answers, you'll just have to test for NULL to avoid the CF exception, and dig into the Java to determine the root cause.

Upvotes: 2

Brad Wood
Brad Wood

Reputation: 3953

The Java method is returning NULL, which in ColdFusion is the same as not being defined. You need to capture the result and test it.

<cfset local = {}><!--- if inside a function, this isn't necessary --->
<cfset local.result = nlp.run() >
<cfif not isNull( local.result ) >
  <cfdump var="local.result">
<cfelse>
  NULL!
</cfif>

Upvotes: 1

Related Questions