BlazeDS Flex Error: Channel disconnected before an acknowledgement was received.
I developed an application with Flex as UI and Java as backend. BlazeDS as the integration between the two and the application was deployed on Tomcat 7 server.
The initial release was on simple http so there were no issues until recently when we were asked to move all the applications over to SSL for security reasons.
The SSL configuration on Tomcat is fairly easy and i was able to access my Flex application on HTTPS with no issues. However there was a strange issue that was occurring everytime the application was left idle for some time.
Upon catching the error message it was:
faultString:'Channel disconnected'
faultDetail:'Channel disconnected before an acknowledgement was received'.
I tried adding few additional configuration parameters to services-config.xml such as:
<login-after-disconnect>true</login-after-disconnect>
But it didnt work.
Finally this is the resolution which took care of this channel disconnect issue permanently:
1. Add the following channel definition to services-config.xml
<channel-definition id = "my-mixed-amf" class = "mx.messaging.channels.SecureAMFChannel">
<endpoint url = "https://{server.name}:{server.port}/{context.root}/messagebroker/amfmixed"
class = "flex.messaging.endpoints.AMFEndpoint" />
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
<connect-timeout-seconds>1000</connect-timeout-seconds>
</properties>
</channel-definition>
2. Update the remoting-config.xml and proxy-config.xml to reflect this new channel.
3. Rebuild the SWF application in Flash Builder IDE and export the release build to Tomcat.
4. Phew!!! The application now works like a charm with no channel disconnect errors anymore even after a long idle time.
Cause:
The channel class uses HTTPS to hit the firewall/proxy, and the endpoint URL must point at the
firewall/proxy. Because SSL is handled in the middle, you want the endpoint class used by BlazeDS to be the
insecure AMFEndpoint and your firewall/proxy must hand back requests to the HTTP port of the BlazeDS server, not the HTTPS port.
Ref: http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=lcconfig_5.html
The initial release was on simple http so there were no issues until recently when we were asked to move all the applications over to SSL for security reasons.
The SSL configuration on Tomcat is fairly easy and i was able to access my Flex application on HTTPS with no issues. However there was a strange issue that was occurring everytime the application was left idle for some time.
Upon catching the error message it was:
faultString:'Channel disconnected'
faultDetail:'Channel disconnected before an acknowledgement was received'.
I tried adding few additional configuration parameters to services-config.xml such as:
<login-after-disconnect>true</login-after-disconnect>
But it didnt work.
Finally this is the resolution which took care of this channel disconnect issue permanently:
1. Add the following channel definition to services-config.xml
<channel-definition id = "my-mixed-amf" class = "mx.messaging.channels.SecureAMFChannel">
<endpoint url = "https://{server.name}:{server.port}/{context.root}/messagebroker/amfmixed"
class = "flex.messaging.endpoints.AMFEndpoint" />
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
<connect-timeout-seconds>1000</connect-timeout-seconds>
</properties>
</channel-definition>
2. Update the remoting-config.xml and proxy-config.xml to reflect this new channel.
3. Rebuild the SWF application in Flash Builder IDE and export the release build to Tomcat.
4. Phew!!! The application now works like a charm with no channel disconnect errors anymore even after a long idle time.
Cause:
The channel class uses HTTPS to hit the firewall/proxy, and the endpoint URL must point at the
firewall/proxy. Because SSL is handled in the middle, you want the endpoint class used by BlazeDS to be the
insecure AMFEndpoint and your firewall/proxy must hand back requests to the HTTP port of the BlazeDS server, not the HTTPS port.
Ref: http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=lcconfig_5.html
Comments
Should the existing secure channel be removed?
Thanks!
Hope its not too late. Thanks.
Here arethe questions again:
"I think I need this also, but, what are the changes you have to make to remoting-config-xml and proxy-config.xml?
Should the existing secure channel be removed?"
Thank you!
1. remoting-config.xml :
<default-channels>
<channel ref="my-mixed-amf"/>
<!--<channel ref="my-amf"/> -->
</default-channels>"
2. proxy-config.xml:
"<default-channels>
<channel ref="my-mixed-amf"/>
<!-- <channel ref="my-amf"/> -->
</default-channels>"
You can remove the secure channel as it is not being referenced anywhere else.
Hope this helps.
Thanks.