Integrating BlazeDS with JBoss

BlazeDS is, quite probably, one of the most efficient ways to glue your RIA interface to a J2EE based application server for data and messaging access. BlazeDS allows one to use the power of Adobe’s AMF binary data transfer format for remoting from within a Java web server back-end. This post shows how to use BlazeDS with JBoss AS.

Getting JBoss Ready

  • Download JBoss AS 6.0 (
  • Extract the downloaded and compressed zip file into your working workspace (e.g. C:\RIADev\JBoss)

Preparing the Web Archive (war)

  • Create a web archive folder in your JBoss server configuration (e.g. JBOSS_HOME\server\default\deploy\blazedstest.war)
  • Start your JBoss server
  • Download the binary distribution of BlazeDS
  • Decompress the downloaded file
  • Decompress the blazeds.war file
  • Copy the WEB-INF directory from the the war file into your web archive folder (e.g.  JBOSS_HOME\server\default\deploy\blazedstest.war)
  • Start Flash Builder 4 (if using the Flash Builder 4 plugin for eclipse ignore this step)
  • Create a new Flex Project
  • Set the project name and ensure that the application type is set to web
  • Click on Next
  • On Server Settings set application server type to J2EE
  • Select BlazeDS
  • Set the Root Folder to your web archive directory (e.g. JBOSS_HOME\server\default\deploy\blazedstest.war)
  • Click on Validate Configuration
  • Set the Output Folder to your web archive directory
  • Click on Next
  • Click on Finish

Prepare your J2EE project

  • In Eclipse, create a new Java Project (e.g. blazedstest)
  • Once created, right click on the project and select properties
  • Select the Java Build Path options
  • Select the Source tab
  • Expand the Source Folder for you new project (e.g. blazedstest/test)
  • Check the box to Allow output folders for source folders (you should now see the Output Folder option)
  • Select the Output Folder option for your src folder and click on edit
  • Select Specific Output Folder and set it to your classes directory in your web archive directory (e.g. JBOSS_HOME\server\default\deploy\blazedstest.war/WEB-INF/classes)
  • Click OK
  • Click OK again to close the project properties panels

BlazeDS Remoting (Java side)

Add the following class to your java project src directory:

package org.riaconnection.remoting;

import java.util.ArrayList;
import java.util.List;

public class FlexRemoting {

	public List listPortugueseSpeakingCountries() {
		  List countries = new ArrayList();
		  countries.add("East Timor");
		  countries.add("Cape Verde");
		  countries.add("Sao Tome and Principe");
		  countries.add("Goa (India)");
		  return countries;


Add new destination to your BlazeDS remoting-config.xml file. You should find it under

    <destination id="flexRemoting" >

You can find more details about the destination properties in here

In the end your remoting-config.xml file should look something like:

<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service" class="">

        <adapter-definition id="java-object" class="" default="true"/>

        <channel ref="my-amf"/>
    <destination id="flexRemoting" >


BlazeDS Remoting (Flex side)

Here is a very simple example application that calls the Java method:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="" 
    xmlns:mx="library://" minWidth="955" minHeight="600">
        <s:RemoteObject id="remoteObject" destination="flexRemoting"/>

    <s:List id="countriesList" x="71" y="14" width="183" height="180" dataProvider="{remoteObject.listPortugueseSpeakingRegions.lastResult}"/>

    <s:Button x="45" y="202" label="Show Portuguese Speaking Regions" click="remoteObject.listPortugueseSpeakingRegions()"/>


Run JBoss and test Web App

Start the JBoss server (JBOSS_HOME/bin/ and point your browser to http://localhost:8080/blazedstest/blazedstest.html and you should see the following application come up in your browser:

BlazeDS remoting example 1

Screenshot of Sample Application


About CrazyPenguin

Software Engineer
This entry was posted in BlazeDS, Flex 3, Flex 4 (Spark). Bookmark the permalink.

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