put json/rest data intermittently is an empty string

81 views
Skip to first unread message

Neil Huyton

unread,
Feb 1, 2014, 11:20:49 AM2/1/14
to col...@googlegroups.com
Hi

I'm developing a json/rest backend with coldbox and railo and backbone.js as the frontend.

When I put data, it intermittently arrives as an empty string. If I repeat the request, it arrives as the expected data.

I've checked the browser console and it seems to be sending the correct data i.e. not an empty string, but a json object.

I am receiving the data like so:

prc.data = deserializeJSON( event.getHTTPContent() );

Any ideas what could be happening? I am not sure if this is a ColdBox issue or a Railo issue, so I am posting on both mailing lists.

I am using Railo 4.1.1.009 final, ColdBox 3.7, Ubuntu 12.04, Apache 2.2.22

Thanks,
Neil

Neil Huyton

unread,
Feb 1, 2014, 3:24:26 PM2/1/14
to col...@googlegroups.com
I've updated to latest Railo and still experiencing the problem.

Here's a stack trace:

No matching property [START] found in [string]
    at railo.runtime.reflection.Reflector.getGetter(Reflector.java:936):936
    at railo.runtime.reflection.Reflector.callGetter(Reflector.java:968):968
    at railo.runtime.reflection.Reflector.getProperty(Reflector.java:1160):1160
    at railo.runtime.util.VariableUtilImpl.get(VariableUtilImpl.java:293):293
    at railo.runtime.PageContextImpl.get(PageContextImpl.java:1325):1325
    at model.service.myservice_cfc$cf.udfCall(/home/mydomain.com/public_html/model/service/MyService.cfc:60):60
    at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:95):95
    at railo.runtime.type.UDFImpl._call(UDFImpl.java:308):308
    at railo.runtime.type.UDFImpl.call(UDFImpl.java:212):212
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:623):623
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:506):506
    at railo.runtime.ComponentImpl.call(ComponentImpl.java:1732):1732
    at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:713):713
    at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1471):1471
    at handlers.validity_period_cfc$cf.udfCall(/home/mydomain.com/public_html/handlers/my_handler.cfc:30):30
    at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:95):95
    at railo.runtime.type.UDFImpl._call(UDFImpl.java:308):308
    at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:199):199
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:624):624
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:506):506
    at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1745):1745
    at railo.runtime.tag.Invoke.doComponent(Invoke.java:203):203
    at railo.runtime.tag.Invoke.doEndTag(Invoke.java:176):176
    at coldbox.system.web.controller_cfc$cf.udfCall6(/home/mydomain.com/public_html/coldbox/system/web/Controller.cfc:756):756
    at coldbox.system.web.controller_cfc$cf.udfCall(/home/mydomain.com/public_html/coldbox/system/web/Controller.cfc):-1
    at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:95):95
    at railo.runtime.type.UDFImpl._call(UDFImpl.java:308):308
    at railo.runtime.type.UDFImpl.call(UDFImpl.java:212):212
    at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:704):704
    at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:713):713
    at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1471):1471
    at coldbox.system.web.controller_cfc$cf.udfCall5(/home/mydomain.com/public_html/coldbox/system/web/Controller.cfc:640):640
    at coldbox.system.web.controller_cfc$cf.udfCall(/home/mydomain.com/public_html/coldbox/system/web/Controller.cfc):-1
    at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:95):95
    at railo.runtime.type.UDFImpl._call(UDFImpl.java:308):308
    at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:199):199
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:624):624
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:506):506
    at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1749):1749
    at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:739):739
    at railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1481):1481
    at coldbox.system.coldbox_cfc$cf.udfCall1(/home/mydomain.com/public_html/coldbox/system/Coldbox.cfc:236):236
    at coldbox.system.coldbox_cfc$cf.udfCall(/home/mydomain.com/public_html/coldbox/system/Coldbox.cfc):-1
    at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:95):95
    at railo.runtime.type.UDFImpl._call(UDFImpl.java:308):308
    at railo.runtime.type.UDFImpl.call(UDFImpl.java:212):212
    at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:704):704
    at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:713):713
    at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1471):1471
    at application_cfc$cf.udfCall(/home/mydomain.com/public_html/Application.cfc:120):120
    at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:95):95
    at railo.runtime.type.UDFImpl._call(UDFImpl.java:308):308
    at railo.runtime.type.UDFImpl.call(UDFImpl.java:212):212
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:623):623
    at railo.runtime.ComponentImpl._call(ComponentImpl.java:506):506
    at railo.runtime.ComponentImpl.call(ComponentImpl.java:1732):1732
    at railo.runtime.listener.ModernAppListener.call(ModernAppListener.java:387):387
    at railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:113):113
    at railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:18):18
    at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2135):2135
    at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2102):2102
    at railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:332):332
    at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:29):29
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728):728
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305):305
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210):210
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222):222
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123):123
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502):502
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171):171
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99):99
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118):118
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408):408
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023):1023
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589):589
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310):310
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source):-1
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source):-1
    at java.lang.Thread.run(Unknown Source):-1

Thanks,
Neil


--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Neil Huyton

unread,
Feb 1, 2014, 4:53:10 PM2/1/14
to col...@googlegroups.com
The problem was due to the fact that I had event/handler/config caching turned off in coldbox while I was developing. The extra time it was taking to process the request must have caused an issue with the getHTTPContent() call. Perhaps the data had already gone, or hadn't arrived yet, or something.

Turning on the caching seems to have solved the problem.

Thanks,
Neil

Neil Huyton

unread,
Feb 1, 2014, 5:02:51 PM2/1/14
to col...@googlegroups.com
Gah! Spoke too soon. it's improved the situation, but it still happens at a lower frequency.

Exist~Dissolve

unread,
Feb 1, 2014, 5:31:03 PM2/1/14
to col...@googlegroups.com

Hi Neil--

We do a lot of this at my work (Ext JS instead of backbone, but lots of RESTful AJAX requests). We're on CF9, and I can't say I've ever noticed this issue.

That said, do you have an example of this that others can try out?

* REST route setup
* JSON request (URL pattern and data)
* handler code

I have test facilities already set up for these kinds of requests, and would be happy to give it a try on a setup similar to yours to see if I can replicate.

--

Neil Huyton

unread,
Mar 20, 2014, 5:38:44 AM3/20/14
to col...@googlegroups.com
I think I've found the answer for my issue with this.

In my ColdBox app, I always send the event data through to my service layer for processing, rather than deal with it in the event handler.
When I run the following code in the service layer, the resulting data is intermittently a blank string:

prc.data = deserializeJSON( event.getHTTPContent() );

If I run the code in the event handler, I can't replicate the error and the data is always the expected json.

Hopefully this may help anybody else who is experiencing the issue.

Cheers,
Neil

Andrew Scott

unread,
Mar 20, 2014, 5:54:59 AM3/20/14
to col...@googlegroups.com
When you pass it off to the serviceLayer, are you passing the event across?

Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/



For more options, visit https://groups.google.com/d/optout.

Neil Huyton

unread,
Mar 20, 2014, 5:57:22 AM3/20/14
to col...@googlegroups.com
Yes, I pass event, rc and prc.

Neil Huyton

unread,
Mar 20, 2014, 5:58:31 AM3/20/14
to col...@googlegroups.com
e.g. myService.doSomething( event, rc, prc );

Andrew Scott

unread,
Mar 20, 2014, 6:04:23 AM3/20/14
to col...@googlegroups.com
Ok, well passing rc & prc is overkill as you can do var rc = event.getCOllection() if you need those inside the service layer. In fact I prefer to pass the one rather than the 3, for that very reason.

Well that doesn't make sense, my guess is that the request is being killed before the service finishes. Is there any threads happening with the service layer?

There are cases when getting this information and not doing an abort will see odd behavior, I think this was the same problem with ContentBox where something in the headers was not there or something didn't function right until an abort was put after it.

This does not sound like that, but seems just as strange.



Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/



br...@bradwood.com

unread,
Mar 20, 2014, 11:36:33 AM3/20/14
to col...@googlegroups.com
Since you are passing the event object into your service, is there a chance there is a var scoping issue or cache going one?
 
Can you detect that scenario and dump out event.getHTTPContent() as well as getHTTPRequestData()?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: br...@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com 
 
 
--------- Original Message ---------
For more options, visit https://groups.google.com/d/optout.

br...@bradwood.com

unread,
Mar 20, 2014, 11:40:23 AM3/20/14
to col...@googlegroups.com
Good idea n the threads.
 
For what it's worth, I don't consider it best practice to pass event, rc, or prc into models.  It creates a weak API and poor encapsulation.  If a service method needs three pieces of data to operate, then make three arguments and pass in what you need.  This help separate the controller from the model in the application and makes the model a bit more re-usable when you might need to call it from a different place in your application, or on another page with differently-named form fields, etc.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: br...@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com 
 
 

Andrew Scott

unread,
Mar 20, 2014, 1:00:43 PM3/20/14
to col...@googlegroups.com
I don't consider it best practice either Brad, but there are times when passing it is better than creating a complex structure to pass in, as there is already a reference, passing it along without wasting memory with another reference is better.



Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/



Neil Huyton

unread,
Mar 20, 2014, 8:39:34 PM3/20/14
to col...@googlegroups.com
No problem, I think that is probably what is happening regarding passing the event into the model. I'll make some changes and see if it stops the issue.

Thanks.

Brad Wood

unread,
May 25, 2017, 1:39:00 AM5/25/17
to ColdBox Platform
Neil, did you ever get to the bottom of this issue.  I just found the exact same behavior happening to me on Lucee 4.5 just like you described.  The content variable is sometimes an empty string, but it works fine the next time.  I'm wondering if this is a bug in Lucee (and Railo before that).

Thanks!

~Brad
--------- Original Message ---------
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+unsubscribe@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

 

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+unsubscribe@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

 

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+unsubscribe@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+unsubscribe@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+unsubscribe@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+unsubscribe@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+unsubscribe@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+unsubscribe@googlegroups.com.

br...@bradwood.com

unread,
May 25, 2017, 1:46:00 AM5/25/17
to ColdBox Platform
Actually, after a bit more Googling, I think it's this Lucee bug:
 

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
 
 
--------- Original Message ---------
--------- Original Message ---------
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

 

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

 

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.

To post to this group, send email to col...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages