Railo/ColdSpring error when remoting in non-default web context

52 views
Skip to first unread message

Tom Bishop

unread,
Dec 5, 2011, 9:43:02 AM12/5/11
to ColdSpring-Users
Hi,

I am getting a strange error with using cfajaxproxy with Model-Glue 3
on Railo 3.3.1.000 final which I believe is due to a misconfiguration
somewhere. However it has started after I moved the
application into a directory/context outside of the tomcat webapps/
root directory and main railo web context.

Prior to moving the app the AJAX call was working perfectly.

When I try to execute an ajax call to the remoteproxy it throws a 500
internal server error and I can see the following error coming back
in
firebug:

Sorry, a ColdSpring BeanFactory named sharedBeanFactory was not found
in application scope. Please make sure your bean factory is properly
loaded. Perhapse your main application is not running?

However, the sharedBeanFactory is set in the application scope
properly as I can dump the following without a problem:
#application.sharedbeanFactory.getbean("modelglue.modelGlueConfiguration")#

I can also cfdump the remote proxy generated by ColdSpring with no
problem.

A stack trace is here:

Sorry, a ColdSpring BeanFactory named sharedBeanFactory was not found
in application scope. Please make sure your bean factory is properly
loaded. Perhapse your main application is not running?
at railo.runtime.tag.Throw._doStartTag(Throw.java:142):142
at railo.runtime.tag.Throw.doStartTag(Throw.java:131):131
at model.services.proxy.remoteproductsservice_cfc$cf.udfCall(C:
\wsi
\myapp\model\services\proxy\RemoteProductsService.cfc:103):103
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:214):214
at railo.runtime.type.UDFImpl._call(UDFImpl.java:418):418
at railo.runtime.type.UDFImpl.call(UDFImpl.java:383):383
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(Variable
UtilImpl.java:
738):738
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:
1444):1444
at model.services.proxy.remoteproductsservice_cfc
$cf.initComponent(C:\wsi\myapp\model\services\proxy
\RemoteProductsService.cfc:56):56
at model.services.proxy.remoteproductsservice_cfc
$cf.newInstance(C:
\wsi\myapp\model\services\proxy\RemoteProductsService.cfc):-1
at railo.runtime.ComponentPage.call(ComponentPage.java:105):105
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:
762):762
at
railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:
179):179
at
railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:
23):23
at railo.runtime.PageContextImpl.execute(PageContextImpl.java:
1991):
1991
at railo.runtime.PageContextImpl.execute(PageContextImpl.java:
1958):
1958
at
railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:
297):297
at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:32):
32
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722):
722
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicatio
nFilterChain.java:
304):304
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC
hain.java:
210):210
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j
ava:
224):224
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.j
ava:
185):185
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBas
e.java:
472):472
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
151):151
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
100):100
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.jav
a:
118):118
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
405):405
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:
193):193
at org.apache.coyote.AbstractProtocol
$AbstractConnectionHandler.process(AbstractProtocol.java:515):515
at org.apache.tomcat.util.net.JIoEndpoint
$SocketProcessor.run(JIoEndpoint.java:300):300
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

I have also tried uncommenting the cftry/cfcatch tags in the generated
remote proxy which shows this error in firebug:

The requested bean factory does not exist in the specified scope, if
you do not intend on handling this error, please use
namedFactoryExists(scope, name) to check for the factory first!

The Error Occurred in
C:\railo\tomcat\webapps\ROOT\dev\coldspring\beans\util
\BeanFactoryUtils.cfc: line 67

65: <cfreturn scopeStruct[arguments.name] />
66: <cfelse>
67: <cfthrow type="coldspring.beans.FactoryReadError" message="The
requested bean factory does not exist in the specified scope, if you
do not intend on handling this error, please use
namedFactoryExists(scope, name) to check for the factory first!" />
68: </cfif>
69: </cffunction>

called fromC:\wsi\myapp\model\services\proxy
\RemoteProductsService.cfc: line 88


Java Stacktrace The requested bean factory does not exist in the
specified scope, if you do not intend on handling this error, please
use namedFactoryExists(scope, name) to check for the factory first!
at railo.runtime.tag.Throw._doStartTag(Throw.java:142):142
at railo.runtime.tag.Throw.doStartTag(Throw.java:131):131
at beans.util.beanfactoryutils_cfc$cf.udfCall(C:\railo\tomcat
\webapps\ROOT\dev\coldspring\beans\util\BeanFactoryUtils.cfc:67):67
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:214):214
at railo.runtime.type.UDFImpl._call(UDFImpl.java:418):418
at railo.runtime.type.UDFImpl.call(UDFImpl.java:383):383
at railo.runtime.ComponentImpl._call(ComponentImpl.java:609):609
at railo.runtime.ComponentImpl._call(ComponentImpl.java:496):496
at railo.runtime.ComponentImpl.call(ComponentImpl.java:1794):1794
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:
733):733
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:
1444):1444
at model.services.proxy.remoteproductsservice_cfc$cf.udfCall(C:\wsi
\myapp\model\services\proxy\RemoteProductsService.cfc:88):88
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:214):214
at railo.runtime.type.UDFImpl._call(UDFImpl.java:418):418
at railo.runtime.type.UDFImpl.call(UDFImpl.java:383):383
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:
738):738
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:
1444):1444
at model.services.proxy.remoteproductsservice_cfc
$cf.initComponent(C:\wsi\myapp\model\services\proxy
\RemoteProductsService.cfc:56):56
at model.services.proxy.remoteproductsservice_cfc$cf.newInstance(C:
\wsi\myapp\model\services\proxy\RemoteProductsService.cfc):-1
at railo.runtime.ComponentPage.call(ComponentPage.java:105):105
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:
762):762
at
railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:
179):179
at
railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:
23):23
at railo.runtime.PageContextImpl.execute(PageContextImpl.java:1991):
1991
at railo.runtime.PageContextImpl.execute(PageContextImpl.java:1958):
1958
at
railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:
297):297
at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:32):32
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722):722
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
304):304
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
210):210
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
224):224
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
185):185
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:
472):472
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
151):151
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
100):100
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
118):118
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
405):405
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:
193):193
at org.apache.coyote.AbstractProtocol
$AbstractConnectionHandler.process(AbstractProtocol.java:515):515
at org.apache.tomcat.util.net.JIoEndpoint
$SocketProcessor.run(JIoEndpoint.java:300):300
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


I am running Railo / Model-Glue 3/ ColdSpring with Apache webserver
and AJP proxy.

I have seen a few threads with this issue coming up (from a few years
ago) but was wondering if they have been resolved.

Any pointers would be greatly appreciated.

Tom

Tom Bishop

unread,
Dec 5, 2011, 10:57:42 AM12/5/11
to ColdSpring-Users
I would like to add that I have just tested my railo setup and it
appears that remoting is working OK - I created a test cfc with a
remote method which I can call without any problem.

This means that this must be a ColdSpring problem.

Any help would be great.

Many thanks,
Tom

Tom Bishop

unread,
Dec 5, 2011, 11:10:56 AM12/5/11
to ColdSpring-Users
Addendum:

Here is my remote proxy bean config:

<bean id="RemoteProductsService"
class="coldspring.aop.framework.RemoteFactoryBean" lazy-init="true">
<property name="target">
<ref bean="products" />
</property>
<property name="serviceName">
<value>RemoteProductsService</value>
</property>
<property name="relativePath">
<value>/myapp/model/services/proxy</value>
</property>
<property name="remoteMethodNames">
<value>*</value>
</property>
<property name="beanFactoryName">
<value>sharedBeanFactory</value>
</property>
</bean>

Also, there are no errors in my product.cfc.

Tom Bishop

unread,
Dec 5, 2011, 11:36:43 AM12/5/11
to ColdSpring-Users
I'm having lots of fun replying to my own post...

I changed the code in the remoteproxybean.cfc so that it just outputs
a cfcatch message (easier than having to comment out cftry/cfcatch
tags and I am now seeing the following error which, to be honest, I
have absolutely no idea what it is about:

Component [myapp.model.services.proxy.RemoteProductsService] has no
acessible Member with name [ADVICECHAINS]

Component [myapp.model.services.proxy.RemoteProductsService] has no
acessible Member with name [ADVICECHAINS]
at railo.runtime.ComponentScopeShadow.get(ComponentScopeShadow.java:
116):116
at model.services.proxy.remoteproductsservice_cfc$cf.udfCall(C:\wsi
\myapp\model\services\proxy\RemoteProductsService.cfc:122):122


at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:214):214
at railo.runtime.type.UDFImpl._call(UDFImpl.java:418):418
at railo.runtime.type.UDFImpl.call(UDFImpl.java:383):383
at
railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:
738):738
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:
1444):1444

at model.services.proxy.remoteproductsservice_cfc$cf.udfCall(C:\wsi
\myapp\model\services\proxy\RemoteProductsService.cfc:144):144


at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:214):214
at railo.runtime.type.UDFImpl._call(UDFImpl.java:418):418

at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:376):
376
at railo.runtime.ComponentImpl._call(ComponentImpl.java:610):610
at railo.runtime.ComponentImpl._call(ComponentImpl.java:504):504
at
railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:
1821):1821
at
railo.runtime.ComponentWrap.callWithNamedValues(ComponentWrap.java:
182):182
at
railo.runtime.ComponentWrap.callWithNamedValues(ComponentWrap.java:
175):175
at railo.runtime.ComponentPage.callWDDX(ComponentPage.java:284):284
at railo.runtime.ComponentPage.call(ComponentPage.java:158):158


at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:
762):762
at
railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:
179):179
at

railo.runtime.listener.ModernAppListener.onRequest(ModernAppListener.java:
83):83

Anyone know anything about this?

Brian Kotek

unread,
Dec 5, 2011, 11:44:35 AM12/5/11
to coldspri...@googlegroups.com
Can you actually see the generated proxy CFC and open it? Does anything in its code look odd?



--
You received this message because you are subscribed to the Google Groups "ColdSpring-Users" group.
To post to this group, send email to coldspri...@googlegroups.com.
To unsubscribe from this group, send email to coldspring-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/coldspring-users?hl=en.


Tom Bishop

unread,
Dec 5, 2011, 2:10:52 PM12/5/11
to ColdSpring-Users
Hi Brian,

This is the code in the generated proxy cfc:

<cfcomponent name="RemoteProductsService"
displayname="RemoteProductsService:RemoteProxyBean"
hint="Abstract Base Class for Aop Based Remote Proxy Beans"
output="false">

<cfset variables.proxyId = CreateUUId() />
<cfset variables.beanFactoryName = "sharedBeanFactory" />
<cfset variables.beanFactoryScope = "" />
<cfset variables.constructed = false />
<cfset setup() />

<cffunction name="setup" access="public" returntype="void">
<cfset var bfUtils = 0 />
<cfset var bf = 0 />
<cfset var error = false />
<cfset var remoteFactory = "" />

<!--- I want to make sure that the proxy id really exists --->
<cfif not StructKeyExists(variables, "proxyId")>
<cfset variables.proxyId = CreateUUId() />
</cfif>

<cflock name="RemoteProxyBean.#variables.proxyId#.Setup"
type="readonly" timeout="5">
<cfif not StructKeyExists(variables, "constructed") or not
variables.constructed>

<!--- it looks like there is an issue with setting up the
variables scope in a static initializer
with remote methods, so we will make sure things are set up ---
>
<cfif not StructKeyExists(variables, "constructed")>
<cfset variables.beanFactoryName = "sharedBeanFactory" />
<cfset variables.beanFactoryScope = "" />
<cfset variables.constructed = false />
</cfif>
<!--- make sure scope is setup (could have been set to '', meaning
application, default) --->
<cfif not len(variables.beanFactoryScope)>
<cfset variables.beanFactoryScope = 'application' />
</cfif>
<cftry>
<cfset bfUtils =
createObject("component","coldspring.beans.util.BeanFactoryUtils").init()/
>
<cfif not len(variables.beanFactoryName)>
<cfset bf =
bfUtils.getDefaultFactory(variables.beanFactoryScope) />
<cfelse>
<cfset bf = bfUtils.getNamedFactory(variables.beanFactoryScope,
variables.beanFactoryName) />
</cfif>
<cfset remoteFactory = bf.getBean("&remoteProductsService") />
<cfset variables.target = bf.getBean("remoteProductsService") />
<cfset variables.adviceChains =
remoteFactory.getProxyAdviceChains() />
<cfset variables.constructed = true />
<cfcatch>
<cfoutput>#cfcatch.message#</cfoutput>
</cfcatch>
</cftry>
</cfif>
</cflock>

<!---<cfif error>
<cfthrow type="coldspring.remoting.ApplicationContextError"
message="#cfcatch.message#" />
</cfif>--->

</cffunction>

<cffunction name="callMethod" access="private" returntype="any">
<cfargument name="methodName" type="string" required="true" />
<cfargument name="args" type="struct" required="true" />
<cfset var adviceChain = 0 />
<cfset var methodInvocation = 0 />
<cfset var rtn = 0 />
<cfset var method = 0 />

<!--- make sure setup is called --->
<cfif not StructKeyExists(variables, "constructed") or not
variables.constructed>
<cfset setup() />
</cfif>

<!--- if an advice chain was created for this method, retrieve a
methodInvocation chain from it and proceed --->
<cfif StructKeyExists(variables.adviceChains, arguments.methodName)>
<cfset method =
CreateObject('component','coldspring.aop.Method').init(variables.target,
arguments.methodName, arguments.args) />
<cfset adviceChain = variables.adviceChains[arguments.methodName] /
>
<cfset methodInvocation = adviceChain.getMethodInvocation(method,
arguments.args, variables.target) />
<cfreturn methodInvocation.proceed() />
<cfelse>
<!--- if there's no advice chains to execute, just call the method
--->
<cfinvoke component="#variables.target#"
method="#arguments.methodName#"
argumentcollection="#arguments.args#"
returnvariable="rtn">
</cfinvoke>
<cfif isDefined('rtn')>
<cfreturn rtn />
</cfif>
</cfif>

</cffunction>

<cffunction name="getLanguageTemplateTitle" access="remote"
returntype="any" output="false" >
<cfargument name="productid" type="numeric" required="false" />
<cfargument name="languageid" type="string" required="false" />
<cfset var rtn = callMethod('getLanguageTemplateTitle', arguments) />
<cfif isDefined('rtn')><cfreturn rtn /></cfif>
</cffunction>


</cfcomponent>


Note: I changed the coldspring remoteproxybean.cfc to just output the
thrown error instead of catching it as the original error type.

I'm not sure if this is odd or not...

Brian Kotek

unread,
Dec 5, 2011, 2:54:32 PM12/5/11
to coldspri...@googlegroups.com
hmmm...well it looks right, you can see the use and checks for the adviceChains variable. So not sure what might be going on for it to think that it doesn't exist, but it seems like it must have something to do with that.

Tom Bishop

unread,
Dec 5, 2011, 3:29:11 PM12/5/11
to ColdSpring-Users
I removed the cfcatch from the remote proxy and it now reverts back to
the error:

The requested bean factory does not exist in the specified scope, if
you do not intend on handling this error, please use
namedFactoryExists(scope, name) to check for the factory first!

Stacktrace The Error Occurred in
C:\wsi\coldspring\beans\util\BeanFactoryUtils.cfc: line 67

65: <cfreturn scopeStruct[arguments.name] />
66: <cfelse>
67: <cfthrow type="coldspring.beans.FactoryReadError" message="The
requested bean factory does not exist in the specified scope, if you
do not intend on handling this error, please use
namedFactoryExists(scope, name) to check for the factory first!" />
68: </cfif>
69: </cffunction>

called fromC:\wsi\myapp\model\services\proxy
\RemoteProductsService.cfc: line 88
called fromC:\wsi\myapp\model\services\proxy
\RemoteProductsService.cfc: line 56

Maybe it is to do with the generated proxy not picking up the
sharedbeanFactory...

Hmmmmm!!!

Tom Bishop

unread,
Dec 5, 2011, 4:59:05 PM12/5/11
to ColdSpring-Users
I have tested the code in the main railo webapps/root context and it
works perfectly.

Something is happening with ColdSpring and the new web context that I
have set up that is causing ColdSpring to reference perhaps a
different context?

I'm fairly new to Railo and web contexts. Perhaps I haven't got the
new context set up properly.

Brian Kotek

unread,
Dec 5, 2011, 6:26:23 PM12/5/11
to coldspri...@googlegroups.com
Since it now sounds like a setup issue, you may have better luck asking on the Railo list.

Tom Bishop

unread,
Dec 5, 2011, 7:38:42 PM12/5/11
to ColdSpring-Users
I worked it out in the end and it was painfully simple:

I had to add a mapping to the proxy in the Railo administrator and
then call it via:

<cfajaxproxy cfc="myMapping.RemoteProductService"
jsclassname="RemoteProductService">

Doh!!!!

Thanks for your help and sorry for bothering you, Brian.

Reply all
Reply to author
Forward
0 new messages