Archive

Posts Tagged ‘flex with Tomcat’

How to deploy flex application in Tomcat

May 15, 2009 32 comments

Hi everybody, deploying flex application is not a big deal and it is very very simple using flex builder. Once you have configured your server settings when you created flex project in flex builder then whenever you compile the flex application, it will automatically deploy your flex application in application server and whenever you run your flex application it will run from the tomcat server and not from the actual location of the flex application.

To deploy flex application you must have two servers and they are follows.

  • BlazeDS server
  • Tomcat application server

I dont want to tell much about Tomcat server because you all know that its application server where we used to deploy our flex application so i do want to concentrate on BlazeDS server. BlazeDS is a open source server which provides set of services which allow flex application communicate with server side java classes and it also helps multiple flex clients communicate with each other. It provides pre-configured web application which does most of our task and help us to easily integrate flex application with server side technologies. So whenever flex application request Java class, blazeDS will interpret, redirect to  corresponding java class and return response to the flex application.

Now its time to explain how to deploy flex application. First create a new web application in the webapps directory of tomcat home directory. ie create new folder in the webapps directory of tomcat home directory. Extract blazeDS.war and will get two folder META_INF & WEB-INF,  copy those folders in to your web application.

Open the flex builder and create a new project. In the new project wizard, dont forget to select application server type as J2EE  and click next. In the configure j2ee server wizard, please uncheck the “use default location for lifecycle data services server” check box and in the “root folder” please specify the root location of your web application you have created in the webapps directory of tomcat home directory. similarly specify your web application name in root URL and context root

Eg :  root URL : http://localhost:8080/{web application name}

Context root : /{web application name}

Now click the validate configuration button before that please ensure that whether the tomcat server is running in your machine or not.  If you have followed all the steps i have described above then it will show that the web root and URL are valid, then as usual click finish. Thats it !!!, you have integrated flex application with tomcat. hereafter whenever you compile flex application it will be updated in tomcat server and when you run the application it will run from the tomcat server and definitely not from the actual location of the flex application.

At last i do have a confession that i have tried my best to make you understand how to deploy flex application in tomcat. If you have any doubt or if i go wrong anywhere please drop as your comments, i will try to fix it as soon as possible. Thank you !!!