House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

NullPointerException in ColdFusion Template

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Hi guys,
Helwig, Till Helge
03/16/12 05:31 A
Hi Cameron,
Helwig, Till Helge
03/19/12 10:00 A
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Helwig, Till Helge
03/16/2012 05:31 AM

Hi guys, I stumbled upon another puzzling problem and could use some help: The culprit is a CF template called by Mach-II and a lot of other templates are involved, but the error occurs always in the same spot: I get a NullPointerException from Java on a line where <cfquery> executes a SELECT statement on a query object that was built on the lines before. The code looks like this: <cfset ReturnQuery = QueryNew( someDatabaseSelectQuery.columnList ) />         <cfloop query="langQuery">   <cfset QueryAddRow( ReturnQuery ) />   <cfloop list="#langQuery.columnList#" index="column">                                <!--- TODO: Replace evaluate() with [] notation --->     <cfset tmpCol = "langQuery." & column & "[langQuery.currentRow][1]">     <cfset querySetCell(ReturnQuery, column, evaluate(tmpCol))>   </cfloop> </cfloop> <cfquery name="ReturnQuery" dbtype="query">   SELECT * FROM ReturnQuery ORDER BY PROD_ID </cfquery> Please don't judge me by that code...it didn't write it...I merely have to make it work again. The error occurs on this line: <cfquery name="ReturnQuery" dbtype="query"> The funny thing is that the same request works with other parameters and not for a special combination of values. Explaining all the stuff that happens based on those parameters would take way too much time. My real question is: How is it possible that a NullPointerException occurs within a CF template? This seems rather odd to me. It appears to be server-specific as well. On some servers the error occurs, on some it doesn't. I can't get my head around how this is even possible. I would appreciate any ideas that might help me get to the bottom of this problem. -- Best wishes, Till Helge

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Cameron Childress
03/16/2012 09:31 AM

You're using lots of dynamic stuff in a Query of Query.  I'll bet a value is sometimes not what you think it is.  CFDUMP out #someDatabaseSelectQuery.columnList#, #ReturnQuery#, and #langQuery# just before the CFQUERY tag and make sure that they contain what you think they do. Also, I see that your QoQ table name is being reused as the table name for the result set (both ReturnQuery).  you say this works sometimes, so that may not be the problem, but it's easy enough to change the name to name="ReturnQueryFoo" and see if it makes the error stop. -Cameron On Fri, Mar 16, 2012 at 5:30 AM, Helwig, Till Helge <till.helwig@saxsys.de>wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Helwig, Till Helge
03/19/2012 10:00 AM

Hi Cameron, Thank you for your reply. I will keep your suggestions in mind. Unfortunately I can't debug it this way right now as it only happens on the productive servers and I'm not allowed to do debugging there. Maybe I will be able to implement logfiles in the next version and dump the queries to a file. Hopefully this will give me some clue as to what is the matter there. I wasn't aware that ColdFusion can cause exceptions in the underlying Java application. This still confuses me. Is there some general explanation for why this might occur? Best wishes, Till Helge ________________________________________ Von: Cameron Childress [cameronc@gmail.com] Gesendet: Freitag, 16. März 2012 14:30 An: cf-talk Betreff: Re: NullPointerException in CF Template You're using lots of dynamic stuff in a Query of Query.  I'll bet a value is sometimes not what you think it is.  CFDUMP out #someDatabaseSelectQuery.columnList#, #ReturnQuery#, and #langQuery# just before the CFQUERY tag and make sure that they contain what you think they do. Also, I see that your QoQ table name is being reused as the table name for the result set (both ReturnQuery).  you say this works sometimes, so that may not be the problem, but it's easy enough to change the name to name="ReturnQueryFoo" and see if it makes the error stop. -Cameron On Fri, Mar 16, 2012 at 5:30 AM, Helwig, Till Helge <till.helwig@saxsys.de>wrote:----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Cameron Childress
03/19/2012 11:03 AM

On Mon, Mar 19, 2012 at 10:00 AM, Helwig, Till Helge <till.helwig@saxsys.de>wrote: > I wasn't aware that ColdFusion can cause exceptions in the underlying Java > application. This still confuses me. Is there some general explanation for > why this might occur? > ColdFusion code is compiled down to Java ByteCode and then executed as Java.  So, really all errors are in the "Java Application" that is your ColdFusion app. -Cameron -- Cameron Childress -- p:   678.637.5072 im: cameroncf facebook <http://www.facebook.com/cameroncf>; | twitter<http://twitter.com/cameronc>; | google+ <https://profiles.google.com/u/0/117829379451708140985>;


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

July 29, 2014

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference