Railo, Flex Remoting and HTTP Auth

On March 29, 2011, in ColdFusion, Flex, Railo, by Anuj Gakhar

I’ve got an app running on Railo which has a Flex app being used and the Flex app uses Flex Remoting to communicate with CFC’s from Railo. That has been working absolutely fine for a few weeks now , until today, when I turned on the Apache based HTTP Authentication on the entire folder. All of a sudden, the remoting calls started giving me this error :-

java.lang.NoClassDefFoundError: flex/messaging/security/TomcatLoginHolder

Obviously, that is not an error that tells you a lot about what has gone wrong. After doing some reading around the web, here is the solution that finally worked for me in the end :-

  1. Download the BlazeDS Turnkey Zip file from Adobe’s website. (blazeds-turnkey- as of this writing)
  2. Unzip the downloaded file and copy /resources/security/flex-tomcat-common.jar and /resources/security/flex-tomcat-server.jar to your tomcat’s lib directory or any other directory if you want (I copied in {tomcat_home}/lib/blazeds)
  3. Open tomcat’s configuration file catalina.properties and find common.loader and add the new jars at the end. My catalina.properties looks like this :-


  4. Add the following to tomcat’s context.xml (/opt/tomcat/conf/context.xml)
    [xml]<Valve className="flex.messaging.security.TomcatValve"/>


  5. Restart Tomcat

At this point, your Flex remoting calls should work fine. It took me a good couple of hours to sort this one out, so I thought I might as well blog it.

P.S. I am assuming that you already have Railo and Tomcat running together on your server and therefore I haven’t spoken about that in this post. There are loads of posts on the web talking about that stuff so if you need help with that, please Google it 🙂

Tagged with:  

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2011 Anuj Gakhar