Setting up BlazeDS

This article explains how to setup BlazeDS for your J2EE web application.

BlazeDS adds a lot of power to your web applications. You can expose your Java classes as Remoting services. You can use the Messaging service of BlazeDS to expose publish subscribe messaging destinations and also use the Proxy service to invoke other services.

More details about BlazeDS can be found at this URL

Updated: Free AIR based Tool to generate Flex code for consuming/exposing Java classes as BlazeDS Remoting services. Visit this URL for more details

Just follow the steps below you will have BlazeDS setup in no time 🙂

Getting BlazeDS

Step 1:

Download release build of BlazeDS. BlazeDS release builds are available at this URL Click on “Download the BlazeDS binary distribution” to download the binary distribution. Binary distribution has just jar files and other configuration files required.

Step 2:

Go to folder where you saved the downloaded file in Step 1. You would have downloaded a file named Extract the content in this file to a folder named blazeds-bin-

Step 3:

In the blazeds-bin- folder you will find a file named blazeds.war and blazeds-bin-readme.htm. blazeds-bin-readme.htm contains terms and conditions and license details. blazeds.war contains required jar files and configuration files for setting up BlazeDS.

Extract the content in blazeds.war file into a folder called blazeds. You can extract the content using tools like winzip.

Now we have downloaded and have the required files extracted to setup BlazeDS for a web application. Let’s create a web application.

Creating web application

If you don’t have Tomcat installed, install Tomcat from

Step 4:

In your Tomcat installation directory, you will find a folder named webapps. Usually it is at this location on Windows Operating System “C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps”

Create a web application named samplewebapp. You do this by just creating folder named samplewebapp under webapps folder.

Setting up BlazeDS

We will setup BlazeDS for the web application created in the previous step.

blazeds – this is the folder in which we have blazeds.war content extracted into  in Step 3

samplewebapp – this is the folder created in Step 4

Step 5:

Copy all .jar files from blazeds/WEB-INF/lib to samplewebapp/WEB-INF/lib

Step 6:

Copy blazeds/WEB-INF/flex folder to samplewebapp/WEB-INF

This folder (blazeds/WEB-INF/flex) contains BlazeDS configuration files. Use these files to configure Remoting/Messaging/Proxy services.

Step 7:

Now we will add Servlet mapping for BlazeDS Servlet named MessageBrokerServlet, so that BlazeDS is invoked when you send request for a Remoting/Messaging/Proxy destination using any of the channels supported.

Copy blazeds/WEB-INF/web.xml to samplewebapp/WEB-INF

If you already have a web.xml configured, then you can just copy the Servlet mapping for MessageBrokerServlet and the session listener. You can either copy the content below or copy it from the blazeds/WEB-INF/web.xml

<!-- Http Flex Session attribute and binding listener support -->
<!-- MessageBroker Servlet -->

That’s it you have BlazeDS setup for your web application. 🙂

Now that you have BlazeDS set up you can try invoking Java methods from your Flex applications or create a simple chat application. You can find articles at the URLs below.

Adobe Rocks!!! 🙂


50 Responses to Setting up BlazeDS

  1. Mark says: is very helpful.


  2. TJ Downes says:

    There is also a good tutorial in the product documentation that shows how to configure BlazeDS for other platforms including ColdFusion:

  3. rk says:

    Thanks for the nice article. I am new for the Flex. Can you please help me on this?


    Getting the following error. Please note even if run thr flexbuilder i am getting the same error.

    Error: Cannot assign operations into an RPC Service (destionation)
    at mx.rpc::AbstractService/[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\]
    at FlexJava/_FlexJava_RemoteObject1_i()[E:\Adobe\RK\adobeFlexTraining\FlexJava\src\FlexJava.mxml:13]
    at FlexJava()[E:\Adobe\RK\adobeFlexTraining\FlexJava\src\FlexJava.mxml:12]
    at _FlexJava_mx_managers_SystemManager/create()
    at mx.managers::SystemManager/initializeTopLevelWindow()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\]
    at mx.managers::SystemManager/[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\]
    at mx.managers::SystemManager/docFrameListener()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\]

  4. Hi RK,

    Please share code to reproduce this.

  5. BAM says:

    Thanks for your help.


  6. Thangaraj says:

    Hi Sujit,

    Getting the below error in Tomcat console during startup and not able to sort it out, would be a great favour if you shed some light on this. Thanks.


    INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
    [Fatal Error] :13:18: Invalid byte 1 of 1-byte UTF-8 sequence.
    **** MessageBrokerServlet failed to initialize due to runtime exception: Exception: flex.messaging
    .config.ConfigurationException: Configuration error encountered on line 13, column 18: ‘Invalid byte
    1 of 1-byte UTF-8 sequence.’
    at flex.messaging.config.AbstractConfigurationParser.loadDocument(AbstractConfigurationParse
    at flex.messaging.config.ServerConfigurationParser.serviceInclude(ServerConfigurationParser.
    at flex.messaging.config.ServerConfigurationParser.parseTopLevelConfig(ServerConfigurationPa
    at flex.messaging.config.AbstractConfigurationParser.parse(
    at flex.messaging.config.FlexConfigurationManager.getMessagingConfiguration(FlexConfiguratio
    at flex.messaging.MessageBrokerServlet.init(
    at org.apache.catalina.core.StandardWrapper.loadServlet(
    at org.apache.catalina.core.StandardWrapper.load(
    at org.apache.catalina.core.StandardContext.loadOnStartup(
    at org.apache.catalina.core.StandardContext.start(
    at org.apache.catalina.core.ContainerBase.addChildInternal(
    at org.apache.catalina.core.ContainerBase.addChild(
    at org.apache.catalina.core.StandardHost.addChild(
    at org.apache.catalina.startup.HostConfig.deployDirectory(
    at org.apache.catalina.startup.HostConfig.deployDirectories(
    at org.apache.catalina.startup.HostConfig.deployApps(
    at org.apache.catalina.startup.HostConfig.start(
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
    at org.apache.catalina.core.ContainerBase.start(
    at org.apache.catalina.core.StandardHost.start(
    at org.apache.catalina.core.ContainerBase.start(
    at org.apache.catalina.core.StandardEngine.start(
    at org.apache.catalina.core.StandardService.start(
    at org.apache.catalina.core.StandardServer.start(
    at org.apache.catalina.startup.Catalina.start(

    > Thangaraj M.

  7. Hi Thangaraj,

    Looks like there is a problem with one of your configuration files. Please make sure services-config.xml/remoting-config.xml and messaging-config.xml are well formed. Please try opening/parsing those files using Mozilla or IE.

    Hope this helps.

  8. Thangaraj says:

    Thanks Sujit, when I opened “remoting-config.xml” in IE, there were errors with double quotes at some places and rectified it.

  9. […] Blaze DSHandling Java Exceptions in Flex applicationRendering PDF content in Adobe AIR applicationSetting up BlazeDSSpeaking at FUG, Blore on using Flex with BlazeDS […]

  10. Suresh says:

    Hi Sujit,
    Thanks for the very informative post. I am researching into using BlazeDS to wrap my calls around Rest service and web services. I have some Action Script object in the client that map to Remote Classes on the BlazeDS side. Right now I am converting the xml response (Remote Class XML objects) that I get from the web/rest service call and use JAXB to convert it to java objects so that blazeds can convert it to AMF3 stream and then to Action Script objects on the client side.
    My question is, Can I avoid creating the java objects before and directly convert the XML into AMF3 stream?


  11. Hi Suresh,

    Try the HTTP channel in BlazeDS.

  12. Suresh says:

    The problem with HTTP channel is that I need to manually convert the xml to Action Script object. I wanted to see if there is any way I can invoke a Http Service and use an API that would convert the response into Action Script objects.

  13. gregh says:

    SatMay23 09 @ 11:37 PT

    (First, thanks for doing this app; its sorely needed).

    Just curious… will your ‘app’ work with the ‘turnkey’ Blaze ds (which I think is just Tomcat/BlazeDs preconfigured?) Since this is what I am currently playing with, I did not want to change my configuration it needlessly…

    TIA //GH

  14. gregh says:

    Hi, you can ignore my prior post as I found the link & explanation (above) to your BlazeMonster post. Cheers //GH

  15. Saidaiah Goud says:

    Thank you very much for your material

  16. Hi Suresh,

    Please try SimpleXMLDecoder class. More details at the URL below.

    Hope this helps.

  17. Sundar says:

    Hi Sujit,
    I have followed the given steps to configure blazeds to WebApp along with that i have created the RemotehandlerClass in my webApp and deployed it to tomcat6.0 server which is configured at Eclipse IDE

    After that i created Flex Project to test the remoting by giving
    destination=”CreatingRpc” in MyApplication.mxml but when i try to run the mxml file as Flex application shows the Button “Remote Service” if i click the button its giving the following message

    [MessagingError message=’Destination ‘CreatingRpc’ either does not exist or the destination has no channels defined (and the application does not define any default channels.)’]

    Can you help me in fixing this out?


  18. alexsimi says:

    Hi Sujit, i tried as you given in the above and was able to do it successfully. Appreciate your knowledge and goodwill to share it… 🙂

  19. vasu says:

    Hi Sujit,am new to flex & Balzeds,i have a doubt ,how to configure jsp as backend,instead of one simple java class,if we configure a simple java class this class cant be a singleton class,then how this class is suitable for web application,unless it extended from Httpservlet.please reply me,and suggest me which component i must use as backend servlet or Jsp for webapplication.

  20. Jack says:

    Hi. Just re: Tomcat when selecting a download version there are a whole lot of options, eg. core, deployer, embedded…just wasn’t sure which was right…thx.

  21. Hi Jack,

    Please try the windows service installer. You can find more details at this URL

    Hope this helps.

  22. Hi Vasu,

    I am sorry, couldn’t understand what exactly you are trying to say. Can you please explain the problem properly.

    Thank you.

  23. Olivier says:

    Hi Sujit,

    What is the advantage between manually setting up the project (the way you do it here) and creating it from the Flex 3 Wizard ?


  24. Hi Olivier,

    Can you please let us know which wizard you are using to setup BlazeDS. I don’t think there will be any difference.

  25. I Like this site your article is very nice , Thanks, very interesting article, keep up it coming

  26. kjv007 says:

    Thank you for this tutorial, but I’m having some problems:

    I’m getting this error, can you please help me on this?
    thanks in advance

    SEVERE: Servlet /FlexBlazeDSBase threw load() exception
    javax.servlet.UnavailableException: Error instantiating application scoped instance of type ‘MyRemoteClass’ for destination ‘myJavaClass’.
    at flex.messaging.MessageBrokerServlet.init(
    at org.apache.catalina.core.StandardWrapper.loadServlet(
    at org.apache.catalina.core.StandardWrapper.load(
    at org.apache.catalina.core.StandardContext.loadOnStartup(
    at org.apache.catalina.core.StandardContext.start(
    at org.apache.catalina.core.ContainerBase.start(
    at org.apache.catalina.core.StandardHost.start(
    at org.apache.catalina.core.ContainerBase.start(
    at org.apache.catalina.core.StandardEngine.start(
    at org.apache.catalina.core.StandardService.start(
    at org.apache.catalina.core.StandardServer.start(
    at org.apache.catalina.startup.Catalina.start(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(
    at org.apache.catalina.startup.Bootstrap.main(

  27. Josh Molina says:

    Hi Sujit,

    First and foremost thank you for a great tutorial.

    Please disregard if this has already been addressed (I haven’t read the latest posts). =)

    When copying/moving the configuration files (xml) from blazeds/flex/ to sampleapp/WEB-INF ***MAKE SURE YOU CHANGE THE LOCATION IN THE web.xml ***

    Currently, the messagebroker looks for services-config.xml in the /flex directory which doesn’t exist in the new app.

    Boston, MA

  28. Hi Sujit Reddy,

    I have gone through this tutorial for configuring the BlazeDs for tomcat, but i want to configure it for Web Sphere application server 6.

    Could you please let me know how to configure blazeDS for Webspehre…

    Thanks in advance.

  29. Divya says:

    Hi Sujit,

    Great post!

    I was wondering if you could provide me with some information. Is there any way that i can use blazeds with jdk1.4 without actually modifying the source code of blazeds? The SAP system’s J2EE server is running on 1.4 and so cant change it.

    Thank you 🙂

  30. Hi Divya,

    Nope, I don’t think so 🙂

  31. Dimitrios says:

    Hi Sujit ,

    Thanks for your tutorial.I am newbie to Flex and this tutorial is just perfect 🙂

    Dimitrios from Athens.

  32. sasi kumar says:

    Download the BlazeDS binary distribution not available sujit

  33. Hi Sujit,

    Go stuck at a very initial stage. Not able to extrct blazeds.war file. Please help.

  34. kishore says:

    hi sujit.i have a prblm when trying BlazeDs integreation with websphere for messageservice.i have done all configuration in serverside(web.xml,jar files,services-config.xml and message-config.xml)when i send the request http://revati:9080/MiddleOffice/ws/messagebroker/amf i am getting Error 404: SRVE0190E: File not found: /messagebroker/amf .i stucked for past three days.plz help me out.its very urgent

  35. RAY says:

    When I run this or any other example, I receive an error that says “Service Does Not Support Command Type 0” and also The ‘Remoting’ service can only process messages of type ‘RemotingMessage’.

    Cant find the solution anywhere. Any ideas ?

  36. Mike says:


    Did you ever find a solution for the Service Does Not Support Command Type 0″ problem? I am seeing the same thing when my client tries to subscribe.

  37. zjank says:

    thank you very much, it helps!

  38. Moloy says:

    Do you have any article (Step by step) regarding BlazeDS setup with Websphere 7? I installed BlazeDS but having hard time setting up Flex environment . I am getting ( Invalid root. The WEB-INF/flex folder must contain either flex-config.xml or services-config.xml.) error. Any help is appreciated.


  39. Srinivas Vinjamuri says:

    Hi Sujit,

    Does Blaze DS remoting service work with Tomcat 5.5 version (or) do we need any specific setup on this part. Please suggest.


  40. Gregg says:

    I’d like to ask you if you have any ideas how to configure BlazeDS with JBoss, not Tomcat. I’ve seen many similar tutorial but all for Tomcat.
    Please let me know

  41. gbofloto says:

    Hi Sujit,
    I tried flex/Java with Blazeds following your tutorial at this page, and it work perfectly.Now, I want to integrate security to my application. I have followed instruction according to BlaseDS developper Guide, but I can’t connect flex to BlazeDS.I tried also spring-securtiy, but I have an error from RDSDispatchServlet.
    Please help me for configure correctly my workspace.

  42. Throstur says:

    I´m having trouble getting connection to a Java class that is not located inside apace/webapps/.. directory. I moved ‘flex’ and ‘lib’ to my WEB-INF folder where my project is located. But I can´t connect to my class. I can only connect to a class that is inside blazeds\WEB-INF\classes. Does anyone have a hint for me ?

  43. ramesh says:

    its really a nice article, i am using it for sample application but it gives me error.

    “The value following “version” in the XML declaration must be a quoted string.”

  44. Hi Throstur,

    As long as the class is in application classpath it will work.

  45. gowtham says:

    Hi Sujit,
    Does the tomcat folder goes into blazeds
    because i saw tomcat/webapps/blazeds/WEB-INF/classes
    in invoking java methods.

    i got confused of it

  46. Venkat says:

    Hi Sujit,

    Thanks for the article. I was able to follow all the steps. I have one quick question – Is it possible to keep the BlazeDS.war and custom.war (my application war)
    separate? If so, how do we achieve this?

  47. Hi Gowtham,

    Its the BlazeDS jar files and configuration files that will be deployed in Tomcat.

  48. Hi Venkat,

    Yes, you can. Please change the endpoint URLs to point to where BlazeDS is deployed and place a crossdomain policy file.

  49. Kumar says:

    Hi Sujit,

    Is it mandatory to register the HttpFlexSession listener in web.xml.
    I tried by commenting the listener and I am able to see the data on client as there are now issues on not registering the listener.
    Can you please explain me in detail or give me links which talks on HttpFlexSession listener and its uses.


Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: