I know this is a hack however it did fix the problem when the flash scope is empty. I should also add once the flash scope is reset, the problem never happens again.
I probably should add that I’m using Railo 4.1.1.003 and its happening on all platforms (windows, mac, & linux/ubuntu).
Every time I’ve seen that, it’s when you’re trying to call the Flash scope before the framework has fully loaded. The request service is created before the flash scope is initialized because it has to wait for the app config to load. Can you show a complete stack trace?
This problem is getting worse… anything that uses the flash scope is breaking :-(. I’ve included everything possible I can from the local error screen.
The variable “flash” is just an empty string.
Line 103:: flash.put(name=instance.flashKey,value=msg,inflateToRC=false,saveNow=true,autoPurge=false);
flash is empty and therefore has not object to put.
You should know I’m using Railo 4.1.2.005 final on Tomcat 7. However this problem has been happening since Railo 4.1. It appears to affect Windows, Mac, & Linux equally. Also, I’ve updated to the last B.E. ColdBox for the past 6 months hoping the problem resolves itself.
No matching Method/Function [put] for call with named arguments found
at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:746):746
at railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1481):1481
at coldbox.system.plugins.messagebox_cfc$cf.udfCall1(C:\tomcat\loc.vencommerce.com\ROOT\coldbox\system\plugins\MessageBox.cfc:103):103
at coldbox.system.plugins.messagebox_cfc$cf.udfCall(C:\tomcat\loc.vencommerce.com\ROOT\coldbox\system\plugins\MessageBox.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.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:713):713
at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:739):739
at railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1481):1481
at coldbox.system.plugins.messagebox_cfc$cf.udfCall1(C:\tomcat\loc.vencommerce.com\ROOT\coldbox\system\plugins\MessageBox.cfc:57):57
at coldbox.system.plugins.messagebox_cfc$cf.udfCall(C:\tomcat\loc.vencommerce.com\ROOT\coldbox\system\plugins\MessageBox.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.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 model.user.userservice_cfc$cf.udfCall(C:\tomcat\loc.vencommerce.com\ROOT\model\user\userService.cfc:37):37
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 handlers.login_cfc$cf.udfCall(C:\tomcat\loc.vencommerce.com\ROOT\handlers\login.cfc:29):29
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(C:\tomcat\loc.vencommerce.com\ROOT\coldbox\system\web\Controller.cfc:764):764
at coldbox.system.web.controller_cfc$cf.udfCall(C:\tomcat\loc.vencommerce.com\ROOT\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(C:\tomcat\loc.vencommerce.com\ROOT\coldbox\system\web\Controller.cfc:648):648
at coldbox.system.web.controller_cfc$cf.udfCall(C:\tomcat\loc.vencommerce.com\ROOT\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(C:\tomcat\loc.vencommerce.com\ROOT\coldbox\system\Coldbox.cfc:236):236
at coldbox.system.coldbox_cfc$cf.udfCall(C:\tomcat\loc.vencommerce.com\ROOT\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(C:\tomcat\loc.vencommerce.com\ROOT\Application.cfc:38):38
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.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51):51
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243):243
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210):210
at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176):176
at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145):145
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92):92
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381):381
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243):243
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:100):100
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953):953
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.ajp.AjpProcessor.process(AjpProcessor.java:200):200
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603):603
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
That request looks like an ordinary request where the framework should be loaded. The flash scope is normally build at the beginning of the registerAspects() method in LoaderService when the framework is coming up. Can you put in some logging to see if that is getting reached as well as some logging in loaderService.loadApplication()? I’m curious if something is redirecting to a different page, aborting, or erroring out while the framework is coming up and preventing it from completing the process. Come to think of it, put some logging in MessageBox.cfc as well. As a plugin, it asks the RequestService for the flash scope and keeps a reference to it. The MessageBox plugin could be getting created too soon in the reinit process and grabbing the flashscope before it’s been built.
Between loaderService.loadApplication(), loaderService.registerAspects, and Messagebox.init(), that should give us an idea of what’s getting executed and in what order.
It might not be a horrible idea to put some check in RequestService.getFlashScope() to not return flash if it hasn’t been built. We could throw an error. The issue with building it is, if the config hasn’t been parsed, what storage would we use? Defaulting to “session” would error if someone had the session scope disabled.
The trigger is a MessageBox.error inside a handler action - nothing special.
MessageBox variable is injected via property - again pretty standard:
property name=“MessageBox” inject=“coldbox:plugin:MessageBox”;
There should definitely be a check in getMessage and setMessage to make sure flash is ready - so there’s a clear error message as to what’s wrong, instead of the obscure “Cannot invoke method put on an object of type java.lang.String with named arguments.”
Only needs to be a simple:
if ( NOT isObject(flash) ) throw (message=“Flash scope not initialised”,type=“whatever”);
As for what’s actually happening - a few dumps suggest that buildFlashScope is initially being setup, so presumably it’s being reset/overwritten at some later stage.
Not sure if I’ll have time to dig further than that, but will update if I find out more.
Ok, so the problem is not limited to MessageBox - this is just where it manifests itself.
The issue is that certain plugins are being loaded before the flash scope is built - i.e. before LoaderService.registerAspects is called.
It seems to be interceptor related - i.e. the plugin initing is occurring with the InterceptorService.onConfigurationLoad function.
I’ve not tracked it down further than that yet - just posting an update before I go eat.
We’re using both built-in and custom interceptors, so I presume it must be something in the latter otherwise I’d expect it to be a more common problem, but will find out either way later.
MessageBox is being injected into some services, which are being resolved before the buildFlashScope call.
The interceptor thing is just the first time coldbox encounters those CFCs - i.e. if the relevant interceptors are disabled, the plugins still get injected too early, I think via ModuleService.activateAllModules call.
In this situation I can probably refactor the MessageBox use into the relevant handlers, and avoid modifying requestservice.cfc
But in general, that still means interceptors and module models can’t use plugins that use the flash scope, and will silently create an invalid instance of such plugins.
If this is desired behaviour then getRequestService().buildFlashScope needs to be called earlier (or alternatively use the code Jeremy posted to re-init when needed).
If it’s not desired behaviour, Coldbox should throw an error inside the init of MessageBox (and any other plugin that depends on flash scope to work), pointing out that it cannot be used at that stage.