Home > Advanced > How to deploy flex application in Tomcat

How to deploy flex application in Tomcat

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 !!!

Advertisements
  1. Vimal
    May 31, 2009 at 6:52 pm

    I am new to Flex and i find this tutorial very useful and learner friendly.
    Thanks for posting it.
    Keep up the good work!

    • June 1, 2009 at 5:40 am

      Thank you for your nice feedback vimal and i wish to keep doing the good work

  2. Tim
    August 27, 2009 at 3:47 pm

    Hi,

    I built a java/flex project using WTP on tomcat server (not blazeds). I found that eclipse does not delopy my web application to the tomcat server directory automatically. However, when I use jboss as the application server, elipse did automatically deploy my web application to the jboss directory.

    Is that supposed to be that we have to manually deploy the application to tomcat in eclipse? thanks

  3. Muhammad Farooq
    September 7, 2009 at 7:32 am

    hi,

    i am still not able to run from tomcat, my application create an socket based connection with a different server when its runs it create its UI but do not connect with server. but when i run it from eclipse its connects successfully.

  4. thara
    December 9, 2009 at 11:51 am

    nice work. it worked for me. thanks for the post.

  5. thara
    December 9, 2009 at 11:52 am

    hi,
    Is it possible to configure server settings for a project which is already created?
    thanks.

  6. sabeerdeen
    January 21, 2010 at 10:11 am

    It is worth to say “good”

  7. sabeerdeen
    January 21, 2010 at 10:30 am

    In net, file upload/download code using flex and servlet is not clear..i expect this from you..can you provide my friend?

  8. sabeerdeen
    January 22, 2010 at 10:04 am

    Heartfelt two thanks..
    one for your quick reply..
    another one for your suggestion..

    • Mahesh
      January 22, 2010 at 12:37 pm

      Thank you very much.

  9. Pranit
    February 11, 2010 at 3:36 pm

    Hi Mahesh, it’s great that i found this article. you have explained the deployment procedure in very simple way. Thanks buddy. Just a little help i need…
    i’m new to Flex. I just want to make few of my concepts clear. What is the diff between Flex builder and a Flex SDK? if i can design Flex apps using Flex builder, then what is the use of SDK? also would you suggest some place where i can start learning Flex + J2EE?

    Thanks in Advance 🙂

    • Mahesh
      February 14, 2010 at 7:14 am

      First of all, I am really happy that you found this article helpful to you. Coming to your question. Flex SDK is generally a software development kit which consists of API, compiler, documentation with few examples and flex builder is an IDE (Integrated development environment), to put it simple, its a tool which helps us to develop our flex application using nice set of features like debugger, content assist etc. but that does not mean you cant develop without flex builder.

      Take an example you can develop a html page with notepad itself but will it notify you when you type the syntax incorrect. Its one of the benefit we can get out of IDE. I hope you understood now.

  10. Bharat Ravichandran
    June 17, 2010 at 6:35 am

    Thanks a lot brother, It worked.
    cheers

  11. gnana
    July 9, 2010 at 11:23 am

    I am fully new to adobe flex and i want to learn about flex. This tutorial is very useful to understant how the flex application is deployed in web server.

    Really good/fantastic article.

  12. Haritha
    July 20, 2010 at 10:05 am

    This document is very good which helps for flex starters to integrate applications with Tomcat very easily.Thanks for the document.

  13. December 8, 2010 at 11:16 am

    Hi, i am new to flex.in the deployment process, i have created a folder under webapps in tomcat home n given a name as samplewebapps.i.e C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\samplewebapps.
    so what will be the web root and root URL for the server location.
    i hv given like: http://localhost:8080/samplewebapps
    root URL: /samplewebapps
    But it is showing webroot doesnt exist.
    Thanks in adv…

  14. December 8, 2010 at 11:18 am

    Hi, i am new to flex.in the deployment process, i have created a folder under webapps in tomcat home n given a name as samplewebapps.i.e C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\samplewebapps.
    so what will be the web root and root URL for the server location.
    i hv given like: http://localhost:8080/samplewebapps
    root URL: /samplewebapps
    But it is showing webroot doesnt exist.
    Thanks in adv

  15. Divya Bathina
    February 3, 2011 at 3:35 am

    hi ,

    I m doing my Mtech project,I would like to know how to connect to database using Postgresql,With BlazeDS flex builder 3.
    Waiting for ur response.
    Thankyou

    • Mahesh
      February 13, 2011 at 4:05 pm

      sorry i was not working in flex for year. Pls get in touch with someone who working in flex now

  16. Seetha
    March 8, 2011 at 5:16 am

    Hi,
    Thank u so much. I successfully deployed my flex application in tomcat.

  17. Pratik Flex Developer
    May 17, 2011 at 6:53 pm

    Hi!
    I had never worked with java.
    Now my client told me that read data from the jsf and it would be in flex context.
    I am not getting what i have to do in order to read that data from the jsf.
    Client shows me one file that is a bridge connector between flex and java.
    I am really confused and need to get that done.
    Please help me , if anybody has an idea.

    Thanks in advance.

  18. Srikanth
    July 22, 2011 at 11:26 am

    this is superb… thanks

  19. Rajesh
    January 10, 2013 at 8:26 pm

    Hi All, i pretty new to Flex, At my work place one application was build with Flex and java, that guy who developed this application, he left the company long back and there is no related single doc for this project,

    Here is the Situation,
    Project with Java and flex,
    i need to change some modifications on this,
    can some one help me how to deploy and how to compile this application,
    i saw there is only tomcatserver was installed related to this application
    need help ASAP.

  20. Nagaraju
    June 20, 2013 at 7:32 am

    Hi ,
    This is really a nice post , it is helping a lot .but I am new to java and i dont know how to set java environment and running a servlet . could you assist me from scratch it will be very help ful. Thank you i appreciate you work.

  21. August 2, 2013 at 7:36 am

    A person necessarily lend a hand to make significantly
    posts I’d state. That is the first time I frequented your website page and up to now? I surprised with the research you made to make this particular post amazing. Magnificent task!

  22. September 20, 2014 at 5:30 pm

    Hey There. I discovered your blog the use of msn. This is a really
    well written article. I will be sure to bookmark it and return to read extra of your helpful info.
    Thanks for the post. I will certainly return.

  1. May 19, 2009 at 5:31 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: