Figure 1.6. You can use OpenEJB and OpenWebBeans to enable both EJB and CDI on Tomcat.
1.5. Brave new innovations
From this point onward, let's start getting a little down and dirty and seeing what the brave
new world of EJB 3 looks like in code. We'll note the primary distinguishing features of
EJB 3 along the way.
1.5.1. “Hello User” example
“Hello World” examples have ruled the world since they first appeared in The C Program-
ming Language by Brian Kernighan and Dennis Ritchie (Prentice Hall PTR, 1988). “Hello
World” caught on and held ground for good reason. It's very well suited to introducing
a technology as simply and plainly as possible. The code samples for this topic will use
Maven, and if you're using Eclipse, you'll find it useful to have the m2eclipse plug-in in-
stalled to integrate Eclipse with Maven.
In 2004, one of the authors, Debu Panda, wrote an article for the TheServerSide.com in
which he stated that when EJB 3 was released, it would be so simple you could write
a “Hello World” in it using only a few lines of code. Any experienced EJB 2 developer
knows that this couldn't be done easily in EJB 2. You had to write a home interface, a
component interface, a bean class, and a deployment descriptor. Well, let's see if Debu was
right in his prediction, as shown in the following listing.