Red Hat

In Relation To CDI

In Relation To CDI

CDI 1.1 slides

Posted by    |       |    Tagged as CDI

Here are the slides[1] from my JavaOne talk on CDI 1.1 :-)


  1. CDI_JavaOne_2011.pdf

CDI support for Infinispan

Posted by    |       |    Tagged as CDI

Kevin Pollet and I were interviewed by DZone about the CDI support in Infinispan - if you are interested in Infinispan, caching or data-grids, this should be interesting for you.

The CDI support is also a partial implementation of JSR-107 - the temporary caching API for Java that has recently reactivated and published a first draft for review . Greg's blog has more on using JSR-107.

Seam.Next Update

Posted by    |       |    Tagged as CDI Seam

We would like to thank everyone that provided feedback to the announcement we made earlier this week.

We feel that the main concerns people have can be expressed as follows (please let us know if we've missed something!):

  • Portability: one of the promises of Seam, CDI and Java EE has been portability, and the community is loath to give this up. We do believe in portability and standards (just look at the evidence). We're reworking our ideas to make sure that portability remains a central goal. We're even looking at ways in which we can make your apps more portable!
  • Getting stuff done: one of the reasons that people loved Seam 1 and Seam 2 was that it offered a complete solution to build a Java enterprise application, on top of the Java EE standard. We feel that we have let the community down in this area, and really want to focus on this goal going forward. Whatever happens, this will be a foundation stone.
  • Community: the Seam community has always been a strong one, and we look forward to continuing to work with this passionate community.
  • Migration: Seam 3 is built on top of standards - Java EE 6 and CDI. JBoss is committed to this as the core programming model and will offer a migration path from Seam 2 to Java EE 6 and make sure that Seam 3 apps run on Java EE 6, and integrate nicely with other parts of the Java EE / CDI ecosystem.

We are currently working on a proposal which we think will address your concerns. We all feel passionately that what is right for the community is right for us. With that in mind we would like to have an open consultation period about what comes next. You guys are the ones at the rockface, and you know what you need. We want to listen to what you have to say. We've started a forum thread on which to have this debate, and the Seam team are going into this with an open mind (but remember we can't promise to do everything you want -- you'll never get a free iPad with every Seam download!).

Those of you who have sent us feedback privately (email, IRC etc.), please chime in on this thread with your thoughts and comments so the entire community can benefit from hearing your viewpoint - some of the feedback has been very insightful.

[Adminstrative note: we've disabled comments on this post, please post on the forum with your thoughts!]

So what's happening with Seam?

Posted by    |       |    Tagged as CDI Seam
28 Sept 2011: Update

We'd like to thank everyone for their comments - on twitter, on IRC and in the comments section. There have been some excellent concerns raised, and, believe it or not, those same reasons are at the heart of why we want to make the changes we discussed here. We have exactly the same concerns the community has raised.

We would like to reassure everyone on a few points:

  • We are convinced that one of things that drove people to adopt Seam 1 and Seam 2 was strong focus on how to build real applications. We are well aware that Seam 3 hasn't offered that and we want to focus on providing that
  • We still believe in portability and standards, and we want to take the knowledge we have about building portable standards and applications out of the Seam silo, and to the rest of the Java EE ecosystem. We will continue to standardise APIs and ideas that we believe are necessary
  • That we love the Seam community and their passion and that we want bring this community into the heart of the Java EE community, where it belongs
  • We will ensure that apps built using Seam 3.x will continue to run. We will continue to support anyone who wants to build a CDI extension

However we made a mistake. We told you about the outcome we think is the right way to address this. We didn't tell you why we want to do it, or how it supports these goals. We don't want to jump right in with a half-baked position right now, and make that mistake again. So we ask that you give us the benefit of the doubt, and trust that we do have the community's best interests at heart, and watch this space for the whole picture over the next couple of days.

I'd like to take a few moments to update everyone on what is happening within the Seam project, and to clear up a few rumours that have started to float around before they start to balloon out of control (how do these things start up anyway???). As some of you might know, we recently held a JBoss face to face meeting in Toronto, Canada where besides consuming vast amounts of alcohol and staying up into the wee hours of the night coding and talking about important stuff like politics and humorous YouTube videos, we actually made a number of important decisions about the direction and focus of the Seam project as a whole.

Over the years, Seam has evolved by quite a substantial amount - if you were to ask the core team members for an executive summary of what Seam was, then the answer would have changed every year. In the very beginning, Seam was intended to solve some of the shortcomings of developing applications with JSF and EJB (and unfortunately this is the impression that has stuck with many people, even until now). It quickly grew into a powerful DI component framework, and more and more features have been added over time. It has spawned quite a number of innovations and sister projects - CDI, Weld and Arquillian to name a few. I'm also pleased to say that Seam is successfully powering many, many production web sites and rich internet applications today.

So, that brings us to the present. In the latter part of 2011, what is Seam's focus, and what goals does it set out to achieve? Well, let's start by looking at the goals it has already achieved. The core features of Seam - dependency injection, contextual component model, event bus, interceptors, i.e. the frameworky stuff has all been standardised as JSR-299 (CDI). Since this is now all part of the Java EE specification, and comes as standard in any compliant Java EE6 container, we now have a fantastic foundation to build on. However, it is just a foundation - as an experienced home renovator I know that the foundation is the most important part of building a structure, however having a foundation alone doesn't give you a place to live - you still need to build a house on top of it.

That's where Seam comes in. It helps you, the developer, by providing the tools and materials necessary to build a house on top of the CDI-based foundation. It does this by integrating various useful libraries - libraries that are important for everyday application development - with the CDI component model so that you can write one kind of stuff, to coin a phrase that Gavin came up with quite some time ago.

But wasn't this already the goal of Seam 3?

Well yes, yes it was. But we've recently come to the conclusion that the Seam project shouldn't be a destination, it should be a journey. Ooh, so Zen!!...but what does this mean? Well, let me explain - Seam's goal is all about supporting the CDI ecosystem, and promoting CDI Everywhere. Why? Because, if we're all building our tools and libraries on the same standards-based component model, then we're all going to be much more productive when it comes to developing our rich internet applications. So, in light of this goal it doesn't make sense for Seam to be gathering crops - rather it should be planting seeds. In other words, there are many modules currently in Seam that we think would make better sense if they were situated somewhere more closer to home, so to speak.

Let's take a look at a concrete example - the Seam Persistence module. This module provides an extension-managed persistence context, useful for when your project needs to inject an EntityManager into a POJO bean, or if your persistence context needs to last longer than a single request. These are features that we consider to be essential for day to day application development. But in light of the goal of strengthening the CDI ecosystem, do these features really belong in Seam? At JBoss we have another well known project which deals with EntityManagers and persistence contexts and other databasey-related stuff - perhaps you've even heard of it (I'll give you a clue, it starts with H).

So instead of Seam trying to capture all of the CDI extensions in one place, like Pokemon, we should be trying to propagate them throughout the greater developer community instead. To that end, our focus is going to shift somewhat, and we've already made some concrete plans towards achieving that goal. Here's a few of the changes that we're proposing:

  • Seam Persistence - Move into the Hibernate core project, re-brand as Hibernate CDI
  • Seam Validation - Move into Hibernate Validator, make CDI support part of the core offering
  • Seam Wicket - Moving into the Wicket project itself, this is already in motion
  • Seam REST - Moving into the RESTEasy project
  • Seam Faces - Moving into RichFaces as a standalone Faces CDI integration library

As a part of the Seam community, you may have concerns that these changes might fracture the Seam project, or the community itself. I'd like to address this concern up front, and say that what we want to achieve is the exact opposite of this. Our aim is to broaden the existing community, by working closer with other projects to achieve a common goal. The current module leads will stay the same, however they will be working together with the other project leads to deliver native CDI support directly from their project. The end of result of this can only be a positive gain, as projects take more ownership of their own CDI integration, and work more closely with the Seam developer community to leverage the experience we have at building CDI extensions.

Seam's role in this new world

So while some modules may graduate from Seam to become part of the broader CDI ecosystem, there are still many features that are unique to Seam itself. These modules will remain within the Seam project for the foreseeable future, and Seam will continue to be an incubator for innovative development solutions and ideas. We still have much work to do, and many ideas on how we can provide new value-added features to Seam for our users.

So will there still be Seam releases?

We are planning on our next bundled release (3.1) to be our last. Note I said bundled - this release is basically a big zip file that contains the latest versions of all our modules. With our new focus, the bundled release just doesn't make a whole lot of sense any more. What we will continue to do however, is release each Seam module whenever it has received enough bug fixes and feature updates to warrant a brand new release.

From what I have heard personally, most of our developers are using Maven for dependency management anyway and so this change isn't going to make an iota of difference to them.

In Summary

So to sum up, Seam is not going away, rather its new goal is to unite the CDI developer community, and it will continue to foster innovation and encourage new ideas and improvements. If you have any questions or concerns about this, I look forward to addressing them in the comment section below.

JavaOne, JUDCon and Devoxx 2011

Posted by    |       |    Tagged as CDI Events Infinispan

This autumn I'm speaking at JavaOne (2nd - 6th October in San Francisco), JUDCon London (31st October, 1st November) and Devoxx (14th - 18th November).

  • Introducing Contexts and Dependency Injection 1.1 - technical session in which I'll overview some of the changes coming in CDI 1.1
  • CDI Today and Tomorrow - panel session on CDI with David Blevins, Arun Gupta, Sivakumar Thyagarajan and Reza Rahman
  • Making Java EE Cloud-Friendly: JSR 347, Data Grids for the Java Platform - BOF with Manik Surtani
JUDCon London
  • Java EE in the Cloud - a technical session in which I'll show you how to use Java EE in the cloud, using Red Hat's OpenShift Platform-as-a-Service
  • Using Infinispan as a remote data store - a technical session with Galder Zamarreño in which we'll show you how to use Infinispan as a remote data store on Red Hat's OpenShift Platform-as-a-Service, with a client app written using CDI.

JUDCon is the official JBoss Users and Developers Conference, and is great value at £100 for a day - so if you near London, I recommend registering today!



Java EE 6 on OpenShift

Posted by    |       |    Tagged as CDI Java EE JBoss AS Seam

Unless you've been living under a rock for the past week, then you'll have seen that Red Hat just added support for JBoss AS 7 on OpenShift (both Express and Flex).

Why should you care?

  • OpenShift is the first PaaS to offer Java EE 6 support
  • OpenShift Express is 100% free, and allows you to run as many non-clustered applications you want on JBoss AS 7
  • OpenShift Express offers neat management of your apps via Git, including a source compilation mode
  • OpenShift Flex gives you much more freedom, including the ability to run clustered applications, and offers monitoring and automatic scaling.
  • OpenShift Flex is free, but you need to provide the EC2 instances. However Red Hat is offering a free 1 month/30 hour trial, so there is no reason not to check it out right now
  • JBoss AS 7 implements the Java EE 6 web profile, with all the benefits of the excellent CDI-based programming model it offers. It's very snappy to use, so deploying apps is quick

How can you learn more?

This week we've been pushing out material like crazy. If you want to give Java EE 6 in the cloud a try check out these resources:

To find out more, check out

JBoss AS 7 and Paris JUG

Posted by    |       |    Tagged as CDI Events JBoss AS Seam

I just got back from the excellent Paris JUG where I presented CDI to a packed room.

We started by covering the basics - the Java EE 6 platform, before doing a deep dive (using the Weld Pastecode example) into the various features CDI offers and when you might want to use them. We also took a look at EJBs and how you can use them to supplement the programming model offered by CDI. The slides I used are available [1].

After the break, we then took a look writing CDI extensions. We took a look at the way you can observe the events CDI fires when the container starts, and how you can use these to modify the deployment. We then used a few examples from the cdi-extensions-showcase to show how simple yet powerful the extensions SPI is. The slides I used are available [2].

You can hardly fail to have noticed that JBoss AS 7 is coming any day now - everyone at JBoss is pretty excited by this!

We want everyone to check it out, as we think the improvements it offers (2.5s boot, small memory footprint, super easy config and more) will have you dancing in the streets. To get you going, we've arranged a special series of webinars covering AS7 for the end of June. Jason Greene will give you an overview of AS7, Dan Allen and myself will show you how to write and test Java EE6 apps for AS7, Brian Stansberry will demonstrate exactly how easy it is to configure a JBoss AS 7 domain and Paul Ferraro and Bela Ban will show you how to cluster JBoss AS 7.

Get your registration done today!

CDI with JRuby

Posted by    |       |    Tagged as CDI

Marek Goldman just wrote a blog on using CDI with JRuby on Torquebox. Nice!

The JBoss World opening Keynote featured one of the best keynote demonstrations I've ever seen!! Part of that demonstration included a RichFaces application customized for the mobile web call TweetStream. We are going to talk about that app, why it works so well for mobile web development, and how you can get it running on your machine.

The entire JBoss World demonstration included many JBoss projects; such as JBoss AS, Infinispan, Hibernate OGM, CDI, and Errai. A video of the keynote & demo is available through the image on the left. The demo starts around 35:15 minutes in. And yes that WAS my real iPad/iPhone password :-)

The latest JBoss Assylum also features many of the developers giving behind the scenes perspective and humor. Each project will be providing blogs and code for its own part. You can get the latest at the JBoss World Keynote 2011 landing page, and follow along with the #jbwkeynote2011 twitter hashtag!

RichFaces TweetStream Application

Wesley Hales and I were looking for an application to show RichFaces 4 on mobile devices for our JUDCon presentation: Filling the Gap: Going Mobile With JBoss Technologies Today. We came up with a simple idea that would be instantly recognizable, allow audience participation, and with just enough UI complexity. It was around this time that JBoss Keynote was being planned, and TweetStream just fit right in!

TweetStream uses twitter4j to search and filter a stream of tweets containing a set of hashtags, and displays them to the user. It also keeps track and calculates the top 10 tweeters, and the top 10 hashtags. It then uses RichFaces Push to keep the UI updated with the latest content across devices.

In front of this Wesley and I built a set of RichFaces 4 views that provide advanced support for different mobile devices. We targeted webkit browsers that run on iPhones, iPads, BlackBerry, and Android devices. Each view is served through a single URL with device detection for a one bookmark solution. We achieved near native behavior using advanced HTML5/CSS3 techniques to process orientation layout changes, transitions, and more.

If you just can't wait to check out the demo on your own machine we have a version of it hosted on RedHat's OpenShift just follow this link The Filling The Gap presentation was also recorded and contains Wesley and I discussing some of the apps details.

Source Code, OAuth, and IDE Integration

Instead of just explaining the various parts all up front lets just jump right into getting the source code, building it, deploying to JBoss AS and integrating it into JBoss Tools. We'll discuss some of the internals below, or is follow up blogs.

note: I'm assuming you have git, Maven, Java 1.6, JBoss AS 6 Final, and JBoss Tools 3.2 for IDE integration

The TweetStream source code is part the RichFaces organization on You can use git to clone the repo with: git clone We'll talk about the structure after we get it running.

Twitter4j & OAuth

While we would love to let you use our twitter account credentials, that would not be so good. This means that you'll need to go through the steps outlined in the README to get twitter4j setup.

Twitter has a good step by step process for this on there OAuth page. Once you go through that you'll be able to update the file with these values:


Once that's done all that is left is deploying the application!

JBoss AS 6

In the base /tweetstream directory run mvn package to build the standalone version of the application. You should now have the file /tweetstream/target/tweetstream.war. Copy this file to the $JBOSS_HOME/server/default/deploy directory.

At this point your can start the server, but I would recommend you start with the $JBOSS_HOME/bin/ -b if you want to access the server from external clients, like your mobile phone ;-)

Once the application starts up you can see it at http://localhost:8080/tweetstream. If you want to try out your smartphone or tablet you may need to modify you firewall to allow port 8080 through. Then access using your tablet, or phone at http://your.ip:8080/tweetstream.

Importing into JBoss Tools

Importing this project into JBoss Tools 3.2 is easy because it uses m2eclipse under the covers. All you need to do is choose File-->Import-->Existing Maven Project, and point it to where you cloned the source code. Eclipse will run through it's normal project import, and in a few minutes have the new project ready to go.

A couple of things to note:

  • Add your JBoss AS 6 server as normal and you can configure TweetStream to be deployed
  • You may see build issues in the /jbw project - I'll explain that in a minute

Structure and Key Files

Now that you have the application running, and hopefully imported into JBoss Tools lets talk about the structure and some of the key areas to look at.

As I alluded to above this application was originally just going to be for Wesley and my JUDCon talk. When it became part of the JBoss World Keynote demo we needed to support two different back-ends. We did this by using the power of CDI, and Maven to create two profiles. A standard profile for JUDCon, and a keynote version. Below is a brief explanation of the various modules:

/tweetstream  #Core application and views
/shared       #Classes files needed across the other two modules
/jbw          #Keynote specific source files to hook into the different backend

The build errors you get in eclipse for the /jbw directory is because of missing dependencies related to the keynote demo. At some point in the near future we'll be releasing the whole keynote demo, but for now Tweetstream is moduler enough to run on its own.

The way we were easily able to shift our backend so easily is a testament to not only JBoss, but to the Java EE as a whole. The pieces fit together well, and with CDI, and JSF we were able to swap in a completely different backend with very little effort.

As I said we'll be following up this blog with deep-dives into the various details, but for now, here are some things to take a look at:

Device detection

We use a great little project called mobileESP to help us with device detection. It is a basic user-agent sniffer that we wrapped in a CDI bean to do our bidding in a class called This could be swapped out for any of the other device detection libraries such as the WURLF API.

We take advantage of JSF 2.0 and facelets templating to provide a single point of access per view to act as a dispatcher for different devices. This provides a single bookmark and URL no matter what device you are accessing it from. You can review that in the home.xhtml

Orientations detection and updates

Using CSS 3 @media selectors makes this a breeze. We use this to great effect in for the tablet view. Always keeping the top tweeters, and top hashtags in the best location.

SmartPhone transitions

Making the page handle the page transitions on smartphones was also easier than you'd think. You can review the details in the phoneHome.xhtml file.


Improvements That Can Be Made

TweetStream was developed quickly and with a singular goal in mind. There are some great opportunities for improvements, future RichFaces components, and more. I would like to encourage anyone who is interested to take look in more detail. Here are some possible ideas for improvements

  • Streamline device detection
  • Customizable search filters
  • Layout components to support transitions
  • RichFaces Mobile Skins
  • Combine, and compress CSS
  • Performance analysis and update
  • Drill-downs on tweets and tags
  • Flush out the desktop version

There are a lot more possibilities, fork it, play, and lets see what you can come up with!! We'll be standardizing and integrating some of these things into RichFaces, and other parts of JBoss so stay tuned!!

Where to go from here

Wesley and I are going to post additional blogs and dig into some of the features just touched on above. All of this should give you a good starting point for your own mobile web application using RichFaces 4 and JBoss! Also, as I mentioned above there are going to be several more blogs related to the JBoss World Keynote demo that will detail Infinispan, Hibernate OGM, the plug computers and more!!

[JBW Keynote Page] [JBW Keynote Twitter] [JBW Asylum] [TweetStream Online] [TweetStream Git Repo] [RichFaces Twitter]

CDI In Paris!

Posted by    |       |    Tagged as CDI

Next week, I'll be at the Paris JUG on the evening of Tuesday 14th June. I'll stawt with a CDI overview, and then move on to discuss CDI extensions.

Duchess (a global network for women in Java technology) posted an interview with me in preparation for the Paris JUG (the interview is in French).

See you in Paris!

back to top