Friday, January 15, 2010

Adobe Flex in Weblogic with BlazeDS & EJB3

In a earlier post I already made Adobe Flex / BlazeDS / EJB2.1 example and this example was deployed on an OC4J J2EE container. In this post I let the same example run in Oracle Weblogic 10.3.2 ( FMW11g) with the BlazeDS jars as a shared library ( this also works with Adobe Lifecycle). Also in the earlier post I needed to use EJB2.1 but with EJB factory of Peter Martin I can use Eclipselink.
To start, we need to download BlazeDS and EJB and Flex Integration jar, Extract these archives so we can copy the jar files to a new location.

We need to make a shared library for weblogic. This is better then just add all the jars to WEB-INF/lib folder of every web application. You can patch the blazeds jars without re-deploying your webapps and you now know exactly which version of blazeds you are using.
Make a folder called blazeds with as subfolders APP-INF and META-INF and add a empty zip in it and call it empty.jar

Copy the blazeds and ejb factory jars in the APP-INF/lib folder

In the META-INF folder we need to add two files application.xml and MANIFEST.MF where we will add the library information for weblogic.

The application.xml

<?xml version = '1.0' encoding="UTF-8" ?>
<application xmlns=""
<description>BlazeDS Library</description>

The MANIFEST.MF has this content
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0RC1
Created-By: 14.0-b16 (Sun Microsystems Inc.)
Extension-Name: blazeds
Specification-Version: 3.2
Implementation-Title: BlazeDS - BlazeDS Application
Implementation-Vendor: Adobe Systems Inc.

We are ready to add this library to the Weblogic Server. The library folder is on the same file system as the weblogic server so I don't need to make an EAR file, I can just use the exploded folder. Open the Weblogic Console and go to Deployments. Here we can install a new Deployment.

Go to blazeds library folder
Install it as a libray

Weblogic will detect the manifest and application.xml and press Finish

In the deployment page we can see the blazeds library.
In the ViewController project we need to make a reference to this shared libray, to do this add a weblogic deployment descriptor. We can use weblogic-application.xml located in the META-INF folder of the EAR or use weblogic.xml in the WEB-INF of the Viewcontroller project. Here is an example of my weblogic-application.xml

<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-application xmlns:xsi=""

The last steps is to configure the web.xml for blazeds and the blazeds configuration files for the EJB call.
first the web.xml of the viewcontroller project.

<?xml version = '1.0' encoding = 'windows-1252'?>
<web-app xmlns:xsi=""
version="2.5" xmlns="">
<description>Empty web.xml file for Web Application</description>





I use the remoting-config.xml and services-config.xml files both located in WEB-INF/flex folder
Here is my remoting-config.xml file, where source element is the JNDI name of my EJB Session Bean, after deployed of your model you can look it up in the Weblogic console ( servers, select the server and in the top there is a link to the jndi page )

<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service" class="">
<adapter-definition id="java-object"
<channel ref="my-amf"/>
<destination id="EmployeeEJB">

my services-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<service-include file-path="remoting-config.xml"/>
<channel ref="my-amf"/>
<factory id="ejb3" class=""/>
<channel-definition id="my-amf"
<endpoint url="http://{}:{server.port}/{context.root}/messagebroker/amf"
<target class="flex.messaging.log.ConsoleTarget" level="Error">

Deploy everything to the Weblogic server.
and at last the Adobe mxml where I call the getEmployeesFindAll method.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="" width="1155" height="206.21213">

<mx:RemoteObject id="srv" showBusyCursor="true" destination="EmployeeEJB"/>
<mx:DataGrid width="1104.6212" dataProvider="{srv.getEmployeesFindAll.lastResult}" height="140.98485"/>



  1. Hi , the integration part looks nice , but please tell me where is the source code of EJB your Files (HRSessionBean)

  2. Hi,

    here you got the link to the jdeveloper project

    I got something extra, I add push to flex with blazeds and ejb, I will make a blog about it.


  3. Nice example. Do you have an example of accessing weblogic web services instead of ejb. We are trying to expose our wls 10.3.2 webservices to be consume either by flex or silverlight and I have a hard time finding some examples on how to do it.

  4. Hi,

    Did you read this

    here you define an endpoint in blazeds and in flex use mx:WebService where you add the requested operation.

    else is the same as this blog entry.

    hope this helps


  5. Hi Edwin,
    I have one struggle with these types of applications in Java 1.4 / Weblogic 8. When you have a Blaze DS or LCDS server on Server A and A Weblogic Server on Server B - we always have to put an RMI "client" jar on the LCDS server "web-inf' lib which means that any time the client changes - even a small bit - we have to recycle the entire LCDS instance to get it to work correctly. (i.e if we add some new methods)

    Is there any other alternative for sharing Java objects between the front and the backend - so that you are not always recycling servers?

    Thanks in advance!

  6. Hi,

    You can try to use shared libraries. Then you only have to deploy a library with the java objects and give it a higher version. without redeploying the webapp


  7. I'm a new to EJB3 and flex integration. Would you recommend any book or article? I'd really appreciate if you could link me to a sample project.

    Thanks a lot

  8. Hi, I am using tomcat, what changes we need to do in order to use shared libraries instead of putting them in WEB-INF/lib folder.
    web.xml has blaz-ds specific entries which refers WEB-INF/lib only. how to configue so that these entries will refer to shared lib on same file system.

  9. Hi,

    dont know shared libraries is supported in tomcat, it is a weblogic feature, you should check the tomcat documentation