AdobeStock_455007340

Installing Flex with ColdFusion

Earlier this week I blogged an example of Flex embedded in ColdFusion. This is a powerful and intuitive way to leverage Flex, but the installation and setup do require some know-how and manual tweaking. So, having gone through the process, and knowing that many of you will want to do the same, I thought I should share the process (just the high-level overview for now).
1: ColdFusion is a Java application, so is Flex (for now). Both ColdFusion and Flex are installed on top of J2EE servers. When ColdFusion MX Enterprise is installed there are three installation types presented as options, the 2nd installs JRun and a ColdFusion instance deployed on top of it, and the 3rd creates a ColdFusion archive (EAR or WAR) for deployment on top of an existing J2EE server. To use Flex with ColdFusion this type of install is required, standalone install (and thus ColdFusion Standard) will not support the deployment of Flex. So, first of all, ColdFusion must be deployed and running on top of a J2EE server.
2: Flex comes with an installer which actually does not really install Flex at all. What it does do is create WAR files for deployment on top of a J2EE server (like JRun). The installer created a folder and deposits several files in it, one of those is named flex.war and it is that file that contains Flex itself and needs to be deployed on the J2EE server. The exact steps to deploy flex.war vary based on the J2EE server being used. There are J2EE management tools that may be used to deploy WAR files, or you may simply expand the war file (using the jar utility) so that it may be detected by the J2EE server.
3: In order to embed Flex MXML (via the Flex JSP Tag Library) in your CFML code, Flex must be deployed in the same server and context as ColdFusion itself. So, if you deployed ColdFusion MX into a context named “cf”, Flex will need to deployed into “cf” as well. The simplest way to do this is to manually expand flex.war into the same folder in which ColdFusion itself was expanded.
4: In the application’s WEB-INF folder there is a file named web.xml, this file contains application information needed by the J2EE server so as to be able to deploy the application in the folder. ColdFusion installs its own web.xml, and Flex comes with one too. These contents of these two files must be merged (as only one web.xml may exist).
5: Then simply restart the server, and both ColdFusion and Flex will be deployed. You can then create .cfm files, .mxml files, and also embed the Flex JSP Tag Libraries within your CFML code.

14 responses to “Installing Flex with ColdFusion”

  1. Michael Hazard Avatar
    Michael Hazard

    Just a quick question…are the second and third CF installation types supported or just the third?
    Thanks,
    Mike

  2. Ben Forta Avatar
    Ben Forta

    2nd and 3rd. Those two are the same, both ways CF is installed as a Java application on top of a J2EE server. The difference between them is that #2 installs a J2EE servers and CF, #3 just prepared CF for installing on an existing J2EE server (that may or may not have been installed via #2 previously).

  3. Michael Hazard Avatar
    Michael Hazard

    Thanks Ben,
    That’s what I thought, but wasn’t sure if I was misreading your entry.
    Right now we’re running CF Standard, but we’re planning a move to Enterprise, and Flex looks very interesting.
    Mike

  4. Mike Klepper Avatar
    Mike Klepper

    What? No Flex on stand-alone CF?!? Will the next version of CF support enought Flex-like features to make this a viable option?

  5. seancorfield Avatar
    seancorfield

    Flex is a separate server application that requires a J2EE application server. It isn’t a question of "CF support" for Flex – it’s a question of J2EE support and CF already runs on J2EE servers (using install options #2 and #3). That’s part of what you pay for when going from CF Standard to CF Enterprise (the ability to use a full J2EE server).

  6. Ben Forta Avatar
    Ben Forta

    Mike, it sounds like you are referring to the "cool new features in CF leveraging Flex" demo at MAX. Those demos were real, and did indeed leverage Flex, so anything is doable. However, we are not far enough along in the Blackstone process to comment on packaging or editioning yet.

  7. Bryan F. Hogan Avatar
    Bryan F. Hogan

    Even customers who have enterprise must install on top of j2ee. Why wouldn’t Flex had been engineered from the beginning to work with all versions of cfmx and all install options.
    It just bothers me, that it was engineered from the beginning to require j2ee.

  8. Marco. Avatar
    Marco.

    CFMX enterprise is too expensive.
    I will try it with BlueDragon Server JX.
    – Marco.

  9. Ben Forta Avatar
    Ben Forta

    Bryan,
    I have to disagree, the Flex audience is not just the CF base, and arguably is much bigger than the CF base. It would have been a mistake to make design and deployment decisions based on CF and the existing CF community. The Flex team has to do what is best for Flex, and being a Java pure-play makes sense (as does a .NET version which they have committed to create). Flex is deployed as a Java application, and therefore needs a Java server (which CF Standalone is not). We are looking at ways to integrate Flex from the CF end of things in Blackstone, but no promises on that one, and no info on what the limitations or restrictions will be (if any).
    — Ben

  10. Bryan F. Hogan Avatar
    Bryan F. Hogan

    CFMX no matter what version or option you chose to install, it runs off of Java. I know that it could have been integrated if they chose to.
    I agree the Java community is larger. But if Flex was built to support it (CFMX SA), everyone could be happy.
    Thanks for your replies, I appreciate your post. I respectfully, think it could have been engineered to make all parties happy.
    I’m going to quit now, because it is turning into just noise.
    Thanks for your time Ben.
    Bryan

  11. Josh Heizman Avatar
    Josh Heizman

    Well, I just now got into the Flex beta with beta 3. The instructions aren’t so ultra clear for integrating Flex with Jrun/IIS/CF.
    Between everything I’ve read, and now this, it sounds like all that needs to be done to run mxml and embed mxml into cfm files (honestly I think this is the only thing I would do) is to expand flex.war into the JRun/servers/cfusion directory, merge the web.xml, and then restart the JRun cfusion app server. Is that correct? There appears to be a sort of "catch-all" cfusion mapping in IIS that will catch the .mxml extension.
    So no need to setup a flex JRun application server, or to use wsconfig.jar and do an install.
    Does this all sound correct?
    While I buy into the whole idea of addressing the Java audience (I am both a CF and Java developer myself), everyone has their own technology they support, and as horrible as this might sound and the Flex team would vehmenty oppose the thought, I’d bet the biggest support/following for Flex is going to be from the Cold Fusion community. We’re already Macromedia fans/followers. So if Blackstone can take a path of integrating Flex and providing Flex attributes to CFML tags as was demonstrated at the conference, I think that will be huge.
    My two cents.. And Ben, please be (and I have no doubt you will) a loud voice in ensuring that there are very clear instructions included with Flex for that CF individual that simply wants to integrate Flex features into their CF code.
    Keep up the great work Ben.
    –Josh H.
    High School Teacher and Freelance Web Developer

  12. Josh Heizman Avatar
    Josh Heizman

    Well, I just now got into the Flex beta with beta 3. The instructions aren’t so ultra clear for integrating Flex with Jrun/IIS/CF.
    Between everything I’ve read, and now this, it sounds like all that needs to be done to run mxml and embed mxml into cfm files (honestly I think this is the only thing I would do) is to expand flex.war into the JRun/servers/cfusion directory, merge the web.xml, and then restart the JRun cfusion app server. Is that correct? There appears to be a sort of "catch-all" cfusion mapping in IIS that will catch the .mxml extension.
    So no need to setup a flex JRun application server, or to use wsconfig.jar and do an install.
    Does this all sound correct?
    While I buy into the whole idea of addressing the Java audience (I am both a CF and Java developer myself), everyone has their own technology they support, and as horrible as this might sound and the Flex team would vehmenty oppose the thought, I’d bet the biggest support/following for Flex is going to be from the Cold Fusion community. We’re already Macromedia fans/followers. So if Blackstone can take a path of integrating Flex and providing Flex attributes to CFML tags as was demonstrated at the conference, I think that will be huge.
    My two cents.. And Ben, please be (and I have no doubt you will) a loud voice in ensuring that there are very clear instructions included with Flex for that CF individual that simply wants to integrate Flex features into their CF code.
    Keep up the great work Ben.
    –Josh H.
    High School Teacher and Freelance Web Developer

  13. Paul McDonald Avatar
    Paul McDonald

    Does it matter which web.xml remains once merged? (cf, flex)

  14. bizarrojack Avatar
    bizarrojack

    I found this via google; I take it you work for macromedia then? Could you try and get someone to put this information into the Flex documentation? It’s very difficult to figure all this out from what we are provided with!

Leave a Reply