Solved

Tool to interpret Coldfusion Stack Trace?

Posted on 2011-03-15
10
654 Views
Last Modified: 2012-06-27
Is there a free tool/utility out there that could be used to make sense of a coldfusion error stack trace? I set up cfmail to mail me if there is an error (the cfcatch object) but sometimes it gets real tricky to figure where exactly the error occurred. I tried looking it up on google but nothing worthwhile or concrete showed up. A free tool where I could paste my stack trace code and analyze would be pretty cool. Any pointers on this issue would also be helpful.
coldfusion.runtime.UndefinedVariableException: Variable X is undefined. at coldfusion.runtime.CfJspPage._get(CfJspPage.java:251) at coldfusion.runtime.CfJspPage._autoscalarize(CfJspPage.java:1441) at coldfusion.runtime.CfJspPage._autoscalarize(CfJspPage.java:1429) at cfAjaxAddB2ecfc919272875$funcAPPLYRATETOALL.runFunction(W:\xxxx\xxx\xxx\xxx\xx\xxx\AjaxAddB.cfc:659) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:360) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:324) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:59) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:463) at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2436) at coldfusion.tagext.lang.InvokeTag.doEndTag(InvokeTag.java:432) at cfajax2ecfc1682498926$funcINIT.runFunction(W:\xxxx\xxx\xxx\xxx\xx\xxx\ajax.cfc:142) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:418) at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:360) at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:324) at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:59) at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:277) at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:463) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:453) at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:320) at coldfusion.filter.ComponentFilter.invoke(ComponentFilter.java:183) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:288) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:86) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.xml.rpc.CFCServlet.invoke(CFCServlet.java:138) at coldfusion.xml.rpc.CFCServlet.doPost(CFCServlet.java:289) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at jrun.servlet.FilterChain.doFilter(FilterChain.java:86) at com.intergral.fusionreactor.filter.FusionReactorFilter.b(FusionReactorFilter.java:376) at com.intergral.fusionreactor.filter.FusionReactorFilter.c(FusionReactorFilter.java:254) at com.intergral.fusionreactor.filter.FusionReactorFilter.doFilter(FusionReactorFilter.java:164) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at jrun.servlet.FilterChain.service(FilterChain.java:101) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106) at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286) at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543) at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203) at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428) at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

Open in new window

0
Comment
Question by:roger_v
  • 6
  • 3
10 Comments
 
LVL 39

Expert Comment

by:gdemaria
ID: 35140955
There are key parts to look at..

You have an undefined variable X at line 659 in the file AjaxAddB.cfc

I suspect that's all the info you probably need about the error.. ?


If you show that part of your code, we can help..

0
 
LVL 39

Expert Comment

by:gdemaria
ID: 35140965

When you mail it to yourself, but sure to use type="HTML" in the CFMAIL command

and email yourself this dump...

<cfdump var="#catch#">

That will give it to you in a cleaner format

You can also send this for more informaton about the user and URL

<cfdump var="#cgi#">
0
 
LVL 1

Author Comment

by:roger_v
ID: 35141266
@gde,

Yes I do have it in html format. I just did a cut'n'paste from that. Attached the code at 659. I guess my question is, is there a defined, clear way of interpreting/analyzing the stack trace?


<cffunction name="APPLYRATETOALL"  access="private" returntype="string">
    <cfargument name="xxid" required="true" type="numeric"/>
    <Cfset out = "">
    <cfset x="">
  
    <cfquery name="myQuery" datasource="#request.mydsn#">
      select *
      from myTable
      where bid = <cfqueryparam cfsqltype="cf_sql_integer" value="#xxid#"/>
    </cfquery>
    <cfloop query="myQuery">
      <cfscript>
        x = applyFunc2(#xxid#,#yyid#);
      </cfscript>
    </cfloop>
    <cfscript>
          out = out & "getFees(top.document.clid, lblt.fO.value, lblt.fD.value, lblt.fMV.value);";
          out = out & "document.lbc.selRate.value='';";
      </cfscript>
      <cfset out = x & out>
      <cfreturn out>
 </cffunction>

Open in new window

0
 
LVL 39

Expert Comment

by:gdemaria
ID: 35141359
>  I guess my question is, is there a defined, clear wa

Not to my knowledge, perhaps another expert can provide more.  I usually just read through key parts looking for items of interest and ignore the rest.

yyid is not defined see below..


    <Cfset var out = "">
    <cfset var x   = "">

           ^^^  you want to add var to your variables in a cfc to ensure they are local

 
    <cfquery name="myQuery" datasource="#request.mydsn#">
      select *
      from myTable
      where bid = <cfqueryparam cfsqltype="cf_sql_integer" value="#xxid#"/>
    </cfquery>
    <cfloop query="myQuery">
      <cfscript>
        x = applyFunc2(#xxid#,#yyid#);

                                         ^^^    yyid is not defined

0
 
LVL 1

Author Comment

by:roger_v
ID: 35141453
Oops sorry, should've mentioned that - yyid is coming from the query - myQuery. sorry.

And for adding var, there is another function in the same cfc, that is private, and has a variable named x defined, but that one has var added to it. But since both are private functions, wouldn't the variables be limited just within those function scopes?
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 39

Expert Comment

by:gdemaria
ID: 35141527
> wouldn't the variables be limited just within those function scopes?

no actually, not without the use of var

This is contrary to the way the rest of Coldfusion works; no boundaries.

But within a CFC, the variables are only forced to be local to a function with the var, so it's important to use it because the variable might extend to other code

Try adding the var, also scope the yyid with the query name   myQuery.yyid

Also, you need to add arguments to scope the xxid:   arguments.xxid  
Some scopes are required, I thought arguments was one of them, I know attributes is required
0
 
LVL 1

Author Comment

by:roger_v
ID: 35141654
Just one more related qn - if I have an argument that accepts "any" datatype, would there be a problem if I used a cfqueryparam with data type of cf_sql_integer? As long as the argument contains some number and not an empty string (''), it should work right?
0
 
LVL 36

Assisted Solution

by:SidFishes
SidFishes earned 25 total points
ID: 35141722
no points for this even if you take my advice :)

several years after I began coding I finally gave up using what I call lazy variables ie: x, y because they are so difficult to debug

your error message tells you little when it says x is undefined. If you use a lot of includes or a framework like fusebox like I do with multiple x's, it can be near impossible to figure out what's going on. Always choose fully scoped, meaningful variables and you will be much happier - i promise :)
0
 
LVL 39

Accepted Solution

by:
gdemaria earned 475 total points
ID: 35141771
>  if I have an argument that accepts "any" datatype

Do you mean an argument on the function?   You can accept it my removing the type or changin to any..

<cfargument name="xxid" required="true"  />


> would there be a problem if I used a cfqueryparam with data type of cf_sql_integer? As long as the argument contains some number and not an empty string (''), it should work right?

Yes, what I often do is wrap it with the val() function.   val() returns a number in all cases, if it is blank or a string, it returns 0

<cfqueryparam value="#val(arguments.theValue)#"


alternatively, you can set the NULL attribute in case the value is empty

<cfqueryparam value="#arguments.theValue#"  NULL="NOT #len(arguments.theValue)#"

0
 
LVL 39

Expert Comment

by:gdemaria
ID: 35141796
I like that Sid,  I'm going to quote you "lazy variables"

even for little loop counter variables, I always double the letter:  such as xx or ii  or  ctr (for counter)  and always scope the variable !

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now