simple cfupdate call not working

67 views
Skip to first unread message

chad alan

unread,
Jun 1, 2016, 2:49:04 AM6/1/16
to Lucee
fired up my very first lucee server tonight! :)

i'm running lucee 5 express on a windows PC.

my test database is a simple msaccess file that is successfully connected to lucee via UCanAccess.

the good news is that data inserts and deletes are working perfectly in my test web app. but, running cfupdate keeps generating a "key [var name here]  doesn't exist.  for example:

Lucee 5.0.0.252 Error (expression)
Messagekey [first_name] doesn't exist

however, i am 100% certain all the variable exist that i'm passing into cfupdate. to verify, i added a cfoutput "debug report" before calling cfupdate and it shows me all the form variables are there before it reaches the cfupdate line and errors out:

form.firstname var= frst 
form.last_name var= lst 
form.email_addy var= em 
form.console_ var= cons
form.contribution_ var= contrib 
form.contribution_details_ var= contribdeets 
form.date_time_ var= {ts '2016-06-01 01:55:07'}

Lucee 5.0.0.252 Error (expression)
Message key [first_name] doesn't exist

As you can see - my cfoutput "debug" reports that form.firstname is being passed and that #form.firstname# 's value is "frst" So, it knows it is there in cfoutput but cfupdate thinks that it is not.

If i remove first_name from cfupdate's formfields, it errors on "last_name" rather than "first.name". But, if i remove ALL the formfields, it oddly chooses to error out on "contribution_" instead.

I know this exact cfupdate code that is failing in lucee runs on ACF because i copied it off an old cf server from 2012 where it was publicly deployed and running successfully.

Any clue what could be causing this and how to resolve? Any questions you have for me? Anyone want my code and DB? I can zip it up and send/post?

A first-time lucee user would love any help you can give! :)

------

[In an attempt to further assist your review of my issue, here is the actual code snippet of the "debugging" cfoutput i shared above followed by the failing cfupdate call:

<cfoutput>
form.firstname var= #form.first_name# 
<br>
form.last_name var= #form.last_name#
<br>
form.email_addy var= #form.email_addy#
<br>
form.console_ var= #form.console_#
<br>
form.contribution_ var= #form.contribution_#
<br>
form.contribution_details_ var= #form.contribution_details_#
<br>
form.date_time_ var= #form.date_time_#
</cfoutput>
<cfupdate datasource="chaddb"
tablename="AdamsEve"
formfields="first_name, last_name, email_addy, console_, contribution_, contribution_details_, date_time_">


and, here is the full error output - even though to my untrained eye, i don't think it offers much clarification as to why the error is occurring:

Lucee 5.0.0.252 Error (expression)
Messagekey [first_name] doesn't exist
StacktraceThe Error Occurred in
G:\LUCEEexp\webapps\ROOT\AdamsEve\party.vnx: line 95 
93: <cfupdate datasource="chaddb"
94: tablename="AdamsEve"
95: formfields="first_name, last_name, email_addy, console_, contribution_, contribution_details_, date_time_">
96: <center>Guest Information Modified. Thanks & See You There!</center>
97: <meta http-equiv="refresh" content="4;url=http://localhost:8888/AdamsEve/">

Java Stacktracelucee.runtime.exp.ExpressionException: key [first_name] doesn't exist 
  at lucee.runtime.type.util.StructSupport.invalidKey(StructSupport.java:67) 
  at lucee.runtime.type.StructImpl.get(StructImpl.java:122) 
  at lucee.runtime.type.util.StructSupport.get(StructSupport.java:136) 
  at lucee.runtime.tag.Update.createSQL(Update.java:277) 
  at lucee.runtime.tag.Update.doEndTag(Update.java:182) 
  at adamseve.party_vnx$cf.call(G:\LUCEEexp\webapps\ROOT\AdamsEve\party.vnx:95) 
  at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:893) 
  at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:808) 
  at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:803) 
  at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:226) 
  at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:43) 
  at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2250) 
  at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2242) 
  at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2210) 
  at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:848) 
  at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:103) 
  at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:62) 
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) 
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) 
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
  at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) 
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) 
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) 
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) 
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) 
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) 
  at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) 
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) 
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537) 
  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085) 
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658) 
  at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222) 
  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1556) 
  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1513) 
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
  at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 
  at java.lang.Thread.run(Unknown Source) 
 
Timestamp6/1/16 2:02:17 AM EDT

thanks again!!! :)

Zac Spitzer

unread,
Jun 1, 2016, 2:53:35 AM6/1/16
to lu...@googlegroups.com
what is the PK

can you post the create table sql? 

CFUPDATE is old and evil should be avoided TBH





--
Win a ticket to dev.objective from Lucee via Twitter, see http://bit.ly/1UbTMWj for details, good luck and see you there...
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/b85b21df-040d-4b16-92f9-aba6ac43bbf6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Zac Spitzer
+61 405 847 168

chad alan

unread,
Jun 2, 2016, 9:55:22 PM6/2/16
to Lucee
Thanks for the reply! :)

First off, some apologies: 

Sorry I posted my same question twice. It was my first time posting to the group and I didn't know it had to be approved before being visible. I assume I had just taken too long writing up the message and it had timed out before submitting; so, i posted it again. (Is there any way to merge the two so people are not replying to two different posts?)

Sorry it took me a while to reply to your comments. (I had to go out of town to fix a crashed server at 3AM a couple days ago. Just got home now.)

Sorry to confuse you with my original cfoutput example not showing the underscore in firstname text. (That was a typo in my post and did not exist in the actual code.)

SO, after those mea culpas, please allow me to provide an update on the actual issue:

Tonight I have commented out that cfoutput block entirely (which contained the missing underscore typo) and instead dumped the scope as Nando recommended so you can actually see the one-to-one associations. Upon review, it still looks to me like all my fields are lining up... (or, am i missing something because I have stared at this code far too long and the issue is right under my nose but i can't see it!) 

Also, per Zac's recommendation, I also added the ID_ field to the cfupdate call since it is the primary key. (Not sure how lucee or UCanAccess handles cfupdate -- again, all this code works perfectly fine as-is on an ACF server using the same ms-access database via ODBC/JDBC without needing to include the primary key in the cfupdate at all.)

Sadly, as you can see, I am still getting the error:

Scope
Entries: 11
console_
stringxbox 360
contribution_
stringcontrib
contribution_details_
stringcontribdeets
date_time_
string
{ts '2016-06-01 01:55:07'}
edit_playa
stringEdit
email_addy
stringb...@here.now
fieldnames
stringcontribution_,password_,console_,edit_playa,first_name,id_,email_addy,last_name,contribution_details_,date_time_
first_name
stringfrst
id_
string9
last_name
stringlst
password_
stringpswd

Lucee 5.0.0.252 Error (expression)
Messagekey [first_name] doesn't exist
StacktraceThe Error Occurred in
G:\LUCEEexp\webapps\ROOT\AdamsEve\party.vnx: line 100 
98: <cfupdate datasource="chaddb"
99: tablename="AdamsEve"
100: formfields="id_, first_name, last_name, email_addy, console_, contribution_, contribution_details_, date_time_">
101: <center>Guest Information Modified. Thanks & See You There!</center>
102: <meta http-equiv="refresh" content="4;url=http://localhost:8888/AdamsEve/">




Any new ideas in light of these changes I made? Thanks again for all the help!! :)

Michael Sprague

unread,
Jun 2, 2016, 10:25:24 PM6/2/16
to lucee
I haven't used cfupdate since the early days of Allaire ColdFusion and tend to agree with Zac about it being "old and evil."

Have you tried doing it with a sql update statement inside a cfquery tag? That would be considered more in line with "best practices" and might possibly yield a more meaningful error message if it still didn't work. Just a thought.

Warm regards,

Mike

Reply all
Reply to author
Forward
0 new messages