JBoss, Seam and BlazeDS

Back when I still had a working Flex Builder, I wanted to do some further prototyping using BlazeDS so I decided to try and get it working in a JBoss (V 4.2.4)install I had going with a Seam (V 2.0.2) app. If you install the Eclipse plugin for Seam, you get the option to generate a “Seam Entity” for a given database table which builds out a simple CRUD app for you. I wanted to see if I could install BlazeDS and use it to hook the Seam generated ejb up to a Flex front end.

Here’s what I had to do:

Create a flex directory under the WEB_INF directory of the web project Seam created. Copy over the four config.xml files you find under the tomcat\webapps\blazeds\WEB-INF\flex directory of your BlazeDS install. (There are template versions under resources\config).

In the services-config.xml, swich the login-command from server=”Tomcat” to server=”JBoss”.

In the remoting-config.xml. comment out or remove all the tutorial destinations and add one for your Seam bean. mine looks like this:

<destination id="seam-userDB">

(my project name is seamFlex)

In your Seam-ejb project, add the library jars found in resources\lib of the BlazeDS install (except for the commons* ones – you should already have those). This is a bit of a kitchen sink approach and you might be able to trim this down if you care to.

You also need to add some configuration to your web.xml :

<!-- MessageBroker Servlet -->

when I tried to run with just this, I ran into initialization issues and after hunting around, I came up with the following fix:

<!-- added this filter for flex stuff -->
<filter-name>Seam Context Filter</filter-name>
<filter-name>Seam Context Filter</filter-name>
<!-- end of flex stuff -->

Finally, copy your Flex app folder into the WebContent directory and things should all work fine. I’ll write more about the Flex app I developed for this in my next post.

Posted in BlazeDS, Flex. Tags: , , . 9 Comments »

9 Responses to “JBoss, Seam and BlazeDS”

  1. Mike Schulze Says:

    Hi I am trying to integrate Seam, Flex and BlazeDS myself. My question is – did you succeed in using seam-mechanisms in your JavaBeans like Bijection? The way you’re describing works for me as well (calling simple JavaBeans) but I get NPEs if I use injected within those methods. I guess this is the case because BlazeDS isn’t aware of the SeamComponents and therefor creates the JavaBeans from scratch (in your case the DemoCustomerList) without using Seam.
    Can you confirm that? – Thx Mike

    • mattreyuk Says:

      Hi Mike – my knowledge of Seam is even less than Flex so I didn’t try anything too clever. I did hit initialization issues until I added the Seam context filter. I know there’s an integration between Flex and Spring and that might be worth looking at for you. I’ve done some limited work with Spring Factory creating beans that might get you where you need to go. It’s pretty nice for plumbing and if I were starting a “real” project, I’d probably take a look at that. I’d try googling the Seam classname that’s NPEing for you and see if you can get some hints on how to force it to instantiate. Christophe Coenraets has just put a new post up on the Spring integration with Flex here

      You could always try a quick and dirty java method to call something that would require Seam to instantiate everything and then call that from a CreationComplete event handler in your Flex – not pretty but it could keep you moving forward until you figure out something better. Let me know how it works out – I’ll be on vacation ’till the 18th so I won’t be online much until after that.

    • mattreyuk Says:

      Mike – back from vacation and I found something else you might be interested in for integrating Seam and Flex.
      Granite DS is an alternative open source alternative to BlazeDS and it claims built in support for Seam ( see this ).

      • Mike Says:

        Hi Matt thx for your reply. We’ve tried to get GraniteDS running before we heard that you could also use BlazeDS to connect your Flex-Frontend to Seam. With GraniteDS we also had some configuration problems.
        Right now we are using Flaming, which is actually quite easy to configure and enables Seam in your backend. It’s scope however seems to be a bit smaller that that of GraniteDS (especially with Tide) because it provides fewer ui-elements to interact with seam. For the generation of the required Value-Objects were using the GAS3-Generator of GraniteDS.
        If I have some sparetime I’ll try to get Tide working, because I think it’s really interesting.

        Have fun – Mike

  2. robert Says:

    Post your example, please.

  3. Armindo Cachada Says:

    If you are looking for a tutorial with source code about blazeds+jboss included you can find one here http://www.spltech.co.uk/blog/jboss/integrate-adobe-flex-and-jboss-using-blazeds-part-i

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 )

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: