Solved

Tool to interpret Coldfusion Stack Trace?

Posted on 2011-03-15
10
660 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
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
 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

733 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