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
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdJfArwBihKDHTSTvpwp5-fQYc7wzenURI_ce1FZj_5YxqsPlvEQhPJTE-W0ZBkgZhGzGoyQOCMyq5XxUTq6zzbAyLM2RmeYB9TJfi5vRPR1K6_IN_Z_vibThTbSojJjkl5oSp-InLYL8/s400/blazeds_ejb_1.png)
Copy the blazeds and ejb factory jars in the APP-INF/lib folder
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWqohOS1XNW3vSmMGfcJ2PwFO_6aay9MIX4Je5viO1N693J2d27zMf7CmtXGQu_JRCDNkgCrN4L68C0OZ2pVq0heTO3-TpNm9GqdvRMu5XioSq0f4vjki_vs6l-cyScT6Z0E6kGTw9UaM/s400/blazeds_ejb_2.png)
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.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTeW4WTxYiJh80ns2pvpPnWHd0aN7ZGi3A36OzXb3n5qGpK3Nvoqk_HBplbmfEFaD0dIn2PTlGL8e-YOCj5B7WFSBwiGeG3e9qBpVQGm7kx4bdvn2xmpVNmIzKf2O59bX9_8VF4oiWsl8/s400/blazeds_ejb_3.png)
The application.xml
<?xml version = '1.0' encoding="UTF-8" ?>
<application xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.4">
<description>BlazeDS Library</description>
<display-name>blazeds</display-name>
<module>
<java>empty.jar</java>
</module>
</application>
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-Version: 3.2.0.3978
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.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYa30PHpQ5nmkvaKW89cA8Ysilc45eHYfmpCZsq2LMy339UXh7DLXlE1Axj5wRnxdoRo0ciOtb2LUB0CDA01mW2zFxlb_yWsA_o_O9Qf5xQXgx5F-gSgAaE2HUS1zv81BXFMeXYgSNQmA/s400/blazeds_ejb_4.png)
Go to blazeds library folder
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-pyfCaS0y4wjE95JJnF4k27EotAbeDx7S8QCWl0yoRywU3AKtdIx5q1wHWTswULkziWVyIHeRuPRMw93BKs4UM9bsen6eJw_RgyEMY6ishmNpXkMKGWxqkkCp8J-9DRIg_Uxe0pav8Wo/s400/blazeds_ejb_5.png)
Install it as a libray
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBvV-s0940mQdcnLDPlU1lCVodg0ks-35DEYEEeZatsNio1s8zQNhavjMcNqM_1J2QuMfOhUVsUwss7PFP8iP3kv6qCLQkdNuT2auQ4xXlpDmLel8eu7AaraORL6H26A1uNVY6qVYT39M/s400/blazeds_ejb_6.png)
Weblogic will detect the manifest and application.xml and press Finish
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGN4eQe8jR6jlNb0KnBCp_gE_Yp15PjLMISa64dfTSYDCTGFYQyzW3lNZIWJrSQAfMF2AmRAVzjsX54BXo_l48P_kwvAm4coM6KELV8vdSxsrHMCUcvLpCVMtsRMpOWo4f69leT18iwQo/s400/blazeds_ejb_7.png)
In the deployment page we can see the blazeds library.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirgYz7R53T7w6QUL5oua60qOSH8vx6w65FzJDcm_mSJGKXhHOAEEMoNXohU95RrFyMdqeuVh18Htpzioc694m30MmVCUvZYlvtD5r8hj_8LNn4T5Stvfq5mPJ2n8m2URByk5gG5OL-cq4/s400/blazeds_ejb_8.png)
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="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-application http://www.bea.com/ns/weblogic/weblogic-application/1.0/weblogic-application.xsd"
xmlns="http://www.bea.com/ns/weblogic/weblogic-application">
<library-ref>
<library-name>blazeds</library-name>
</library-ref>
</weblogic-application>
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="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
<description>Empty web.xml file for Web Application</description>
<servlet>
<servlet-name>MessageBrokerServlet</servlet-name>
<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
<init-param>
<param-name>services.configuration.file</param-name>
<param-value>/WEB-INF/flex/services-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MessageBrokerServlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>flex.messaging.HttpFlexSession</listener-class>
</listener>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
</web-app>
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="flex.messaging.services.RemotingService">
<adapters>
<adapter-definition id="java-object"
class="flex.messaging.services.remoting.adapters.JavaAdapter"
default="true"/>
</adapters>
<default-channels>
<channel ref="my-amf"/>
</default-channels>
<destination id="EmployeeEJB">
<properties>
<factory>ejb3</factory>
<source>flex_ejb2-Model-HRSessionEJB#nl.whitehorses.model.services.HRSessionEJB</source>
</properties>
</destination>
</service>
my services-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<service-include file-path="remoting-config.xml"/>
<default-channels>
<channel ref="my-amf"/>
</default-channels>
</services>
<factories>
<factory id="ejb3" class="com.adobe.ac.ejb.EJB3Factory"/>
</factories>
<channels>
<channel-definition id="my-amf"
class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"
class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>false</polling-enabled>
</properties>
</channel-definition>
</channels>
<logging>
<target class="flex.messaging.log.ConsoleTarget" level="Error">
<properties>
<prefix>[Flex]</prefix>
<includeDate>false</includeDate>
<includeTime>false</includeTime>
<includeLevel>false</includeLevel>
<includeCategory>false</includeCategory>
</properties>
</target>
</logging>
</services-config>
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="http://www.adobe.com/2006/mxml" width="1155" height="206.21213">
<mx:applicationComplete>srv.getEmployeesFindAll()</mx:applicationComplete>
<mx:RemoteObject id="srv" showBusyCursor="true" destination="EmployeeEJB"/>
<mx:DataGrid width="1104.6212" dataProvider="{srv.getEmployeesFindAll.lastResult}" height="140.98485"/>
</mx:Application>