Monday, December 31, 2012

BlazeDS Error Solved

I have been working on a fun project that requires a streaming gateway between Adobe ColdFusion and Apache Flex.  I had a vanilla installation of CF 9.0.2 (after numerous attempts to configure my current setup) and was consistently getting the error:
Unable to find the Flex adapter for destination ColdFusionGateway in the RMI registry on localhost:1099
I haven't done much Java in some time and BlazeDS installed with CF 9 is generally pretty simple, so I correctly assumed the problem was configuration related instead of going down a rabbit hole.  The problem was that this code was working on another of my machines just fine, and this is a fresh install and the config files matched.

Googling brought up the same few posts which were not related to my situation, so I wanted to post the solution here quickly in case I can save someone else 3 days of hair-pulling.

In the end I had to change the definition for the ColdFusionGateway destination in messaging-config.xml.  I had to uncomment and set the gatewayhost property to localhost as shown below:
<gatewayhost>localhost</gatewayhost>
The help text states:
If ColdFusion is running on a different host, enter that here.  Default is to expect ColdFusion and Flex to share the same web application. You must enter 'localhost' if CF and Flex are not in the same web app.
This doesn't make sense since I am calling the messaging component from within ColdFusion (BlazeDS installs with CF 9+).  This is why I couldn't figure out what setting needed flipped.  I would understand if I was getting this message in my Flex application, as in my current test environment the Flex application I am working on I am running out of Flash Builder in debug mode.  The Flex project does not live anywhere within the context of ColdFusion so this setting would make sense.

I also don't recall ever having to do this prior to ColdFusion 9.0.2.  It is also worth noting that I am on Mac OS X Mountain Lion (10.8) and also reproduced this in 9.0.2 on OS X 10.7.

Regardless, I am back up and running, and if you are reading this I hope this helps you as well.