Application Scope Issue with BlazeDS

I have a Flex application that was backed by ColdFusion server. We are migrating to Lucee. To support the Flex app, I turned on BlazeDS in Lucee and verified that flex2gateway is online. However, I am experiencing some issues that I haven’t on ColdFusion and this has to do with how CFC component finds the nearest Application.cfc.

I will explain my environment setup and tech stacks first before going into details.

Lucee Version:
Web Server: IIS


  • Location of configuration files: C:\inetpub\wwwroot\WEB-INF\flex
  • messaging-config.xml and proxy-config.xml are pretty standard
  • Channels in services-config.xml that we use
		<channel-definition id="my-cfamf-collection" class="mx.messaging.channels.AMFChannel">
			<endpoint uri="http://{}:{server.port}{context.root}/flex2gateway/collection" class="flex.messaging.endpoints.AMFEndpoint"/>
		<channel-definition id="my-cfamf-collection-secure" class="mx.messaging.channels.SecureAMFChannel">
			<endpoint uri="https://{}:{server.port}{context.root}/flex2gateway/collectionsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
  • Destination in remoting-config.xml
	<destination id="appName">
			<channel ref="my-cfamf-collection" />
			<channel ref="my-cfamf-collection-secure" />

Additional Tools in IIS

  • Installed IIS URL Rewrite and Application Request Routing (ARR) because the request that the Flex application makes does not include the port number 8888. A reverse proxy is set up to accept a regular 80/443 port number and fix URL to add the 8888 port number
  • URL Rewrite Configuration in C:\inetpub\wwwroot\web.config
				<rule name="Flex2Gateway" stopProcessing="true">
					<match url="^flex2gateway/(.*)$" />
					<conditions />
					<action type="Rewrite" url="http://localhost:8888/flex2gateway/{R:1}" />

Software Stacks

  • Coldspring - all service CFCs are managed in the bean factory
  • Uses Coldspring’s RemoteProxyBean to auto-generate 3 remote components

** Server Application Directory Structure**

            coldspring - contains coldspring library codes
                                    service - Contains the application service files
                                    remote - this is where the three auto-generated remote proxy cfc files are

The proxy bean components in the remote directory should be able to access the Application scope in order to access the Coldspring bean factory (application.beanFactory). However, when the Flex app invokes a function in one of the proxy components in the remote directory, the application scope is not that of the Application.cfc at the root of mainDir. If I dump the application scope, it has an empty applicationname. My understanding is that when a function in the component is called, Lucee is supposed to look for the nearest Application.cfc by going up the directory path. But that doesn’t seem to happen here.

For testing purposes, I placed another Application.cfc inside the remote directory and gave it a distinct name (“testApp”). I confirmed that Lucee is able to find this Application.cfc when the Flex app pings one of the proxy components. Then, I moved the new Application.cfc to the server directory and it was still able to find it. Then, I moved it to the subdirfour directory and Lucee still found it. Finally, when I moved the Application.cfc to subdirthree, that Application scope is lost and the cfdump shows a blank applicationname again.

Is there a reason why Lucee only searches up to 2 upper directories and then creates a blank application scope if not found? This seems to happen when using Flex2Gateway.