Java Champion / JavaOne Rockstar Adam Bien (adam-bien.com) is a self-employed consultant, lecturer, software architect, developer, and author in the enterprise Java sector. He is also the author of several books and articles on Java and Java EE technology, as well as distributed Java programming. adam has posted 59 posts at DZone. View Full User Profile

EJB 3: Dead Or Alive?

08.22.2008
| 14324 views |
  • submit to reddit

JavaMagazin, one of the biggest German Java-related magazines, started an online survey (known as quickvote) with the question "EJB - Dead Or Alive". The result really surprised me:

Quickvote (freely translated by me, here's the original):


EJB - Dead Or Alive?

I'm using EJB 2x. (8%)
 

 

I'm using EJB 3. (58%)

 

 

I don't use EJB and "pure" Web-Stack instead (Tomcat & Co.). (12%)

 

 

I don't use EJB and the alternative Stacks instead (Spring & Co.). (22%)

 

 

Participants: 1375 (at 19.08.2008)

What surprised me is the small percentage of EJB 2.X that seems to be in use. In Germany, there is still a huge number of EJB 2.0 projects around. Most of them will be ported to Java EE 5 next time round.

The second surprise is the level EJB 3 adoption. I'm using EJB 3 in several projects, but the amount of 58% in this context is huge. I actually thought that the aggregated amount of the alternatives would be greater than EJB 3 and 2 together, but the opposite is true.

Hopefully this survey was not sponsored by the "EJB-Mafia" :-). So if you would like to keep your job and learn more about EJB 3 start here in my blog. :-).

From http://www.adam-bien.com

AttachmentSize
figure-1.png16.31 KB
Published at DZone with permission of its author, adam bien.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags:

Comments

Steve Hicks replied on Fri, 2008/08/22 - 10:06am

If these values are true then EJB3 is the main way people are developing (at least in Germany). I noticed that there were well over double the amount of participants than a survey on whether people consider themselves Spring developers. I wonder what values we would get in other countries.

On my current project the main hurdle to going to EJB3 is the application server (WebLogic 9). We might upgrade to 10 next year but we have already (happily) gone done the Spring path.

 I can see an interesting choice for green field developments deciding on EJB 3 or Spring. 

Tiago Brito Spindola replied on Fri, 2008/08/22 - 10:38am

What really surprises me is that someone can be surprised with quickvote results! They are biased and consequently not representative.

Ronald Miura replied on Fri, 2008/08/22 - 1:02pm

In the same site, there is this other poll, which seems to indicate massive use of Tomcat. But... Tomcat don't have support for EJB3! How is that possible? Are they all emulating EJB3 with JBoss embedded server? (a kind of ugly hack IMHO)

 

Translation by Google :)

Use Tomcat?
The Tomcat server is the foundation of all web projects, in which I am involved. (58%)
 
The Tomcat, I sometimes use (Entscheidung/Kunden- political or corporate default). (12%)
 
The Tomcat, I sometimes use (technology decision depending on the application case). (24%)
 
Tomcat for me not in question because I / we do not open source (s). (1%)
 
The Tomcat is not technically well, so I use him. (5%)

Geertjan Wielenga replied on Fri, 2008/08/22 - 1:06pm in response to: Ronald Miura

[quote=ronaldtm]

In the same site, there is this other poll, which seems to indicate massive use of Tomcat. But... Tomcat don't have support for EJB3! [snipsnipsnip]

[/quote]

 

Really? Depends. http://java.sys-con.com/node/487561

Ronald Miura replied on Fri, 2008/08/22 - 1:33pm

Well, I don't think most Tomcat users use OpenEJB (actually, I'm yet to see someone using OpenEJB at all).

But yes, maybe I'm wrong and everybody out there are happy users of EJB3 on Tomcat...

adam bien replied on Sat, 2008/08/23 - 8:38am in response to: Ronald Miura

[quote=ronaldtm]

In the same site, there is this other poll, which seems to indicate massive use of Tomcat. But... Tomcat don't have support for EJB3! How is that possible? Are they all emulating EJB3 with JBoss embedded server? (a kind of ugly hack IMHO)

 [/quote]

Not only that - JBoss is shipped with Tomcat as WebContainer. So it is indeed a foundation. I actually used JBoss almost exclusively until 2-3 years ago and then switched to Glassfish. So having Tomcat as a foundation doesn't exclude EJBs. 

Geronimo is using Tomcat as well...

adam bien replied on Sat, 2008/08/23 - 8:39am in response to: Ronald Miura

You are right Tomcat +  OpenEJB is not the most obvious combination (rather esotheric in my opinion :-)), but JBoss with Tomcat is deployed massively...

adam bien replied on Sat, 2008/08/23 - 8:42am in response to: Tiago Brito Spindola

[quote=tbspindola]

What really surprises me is that someone can be surprised with quickvote results! They are biased and consequently not representative.

[/quote] 

 

I actually thought that EJB 3 are less popular. You aren't surprised?  The survey is not representative, but still interesting.

adam bien replied on Sat, 2008/08/23 - 8:46am in response to: Steve Hicks

Steve,

 

thank you for your comment. I'm using EJB 3 for about 2 years and it works really well. They are very lean, vendor neutral (the portability works in most cases), and you can get rid off nearly all your XML :-).

More important: I asked the developer in retrospectives about their experiences with EJB 3 - the answers were really positive... and EJB 3.1 will get even better :-).

Steve Hicks replied on Sat, 2008/08/23 - 9:15am in response to: adam bien

Do you see EJB3 being used instead of Spring or a choice developers need to make when starting a new development? If the latter, what sort of projects are suited for each stack. Certainly having used Spring for the last year I really appreciate how it makes it easier to test my code (without having to deploy it to a container - which also simplifies code analysis using Emma)

 

Any justifications would be interesting? 

adam bien replied on Sat, 2008/08/23 - 9:38am in response to: Steve Hicks

Hi Steve,

I have trouble to ensure the quality of Unit-Testing in general - is seems like only obvious stuff is going to be tested. This phenomenon is somehow framework / platform agnostic. Its easier to ensure the test coverage that way :-).

 EJB 3 and JPA are just POJOs. You can absolutely start them outside of the container. This is actually what we did it. We had only to write few lines of "utility"-code.

Spring is a superset of EJB 3. So you can absolutely start with EJB 3 and in case they are not sufficient, just enhance your code with Spring. We discussed this approach even at the JAX conference (probably 2006), together with Juergen Hoeller.

Because EJB 3 support comes for free with the application server, we just used existing functionality. It was the simplest solution.

Probably I should post some entries about EJB 3 and testing as well.

Why to justify :-) - EJB 3 are in most cases the simplest possible solution - not the most powerful one, but is absolutely sufficient for the most of use cases I know...  Developers really appreciated the lack of necessary XML. It was a good decision to kill the deployment descriptors...

Ronald Miura replied on Sat, 2008/08/23 - 9:36pm in response to: adam bien

Indeed... I didn't read that line carefully enough (about the 'foundation' thing). :)

Anyway, while I still think it's hard to believe EJB3 is as mainstream as the post implies, I agree that it may somewhat grow in adoption, in the near future. If it's good or bad, only time will tell :)

adam bien replied on Sun, 2008/08/24 - 8:21am in response to: Ronald Miura

[quote=ronaldtm]

Indeed... I didn't read that line carefully enough (about the 'foundation' thing). :)

Anyway, while I still think it's hard to believe EJB3 is as mainstream as the post implies, I agree that it may somewhat grow in adoption, in the near future.

[/quote]

 The adoption is much better, as expected. The only problem of EJB 3 is the name and some biaz. After demoing and a Proof Of Concept, it is hard to criticize the EJB 3 model. It is as lean, as it probably can be.

[quote=ronaldtm]

If it's good or bad, only time will tell :)

[/quote]

Time will tell - but the dependency of the EJB 3 model can be drastically minimized with some trivial idioms. So the costs to migrate to something else are low - you just have to remove the @Stateless annotation - and you will get a POJO with an optional POJI...

Therefore the risks of the introduction of EJB 3 are very low - the benefits significant, and you get interoparability with J2EE legacy stuff, monitoring capabilities and portability for free.

There is another "phenomenon", at least in Germany, - Glassfish. It gets more and more popular - perhaps this is one of the reason for the popularity of EJBs.

Slim Ouertani replied on Mon, 2008/08/25 - 4:24am

Hi adam,

EJB 3 is very interresting concept, but now we start speeking about OSGI. I' am  sure that EJB will be alive for the next years even osgi are adopted by many starting projects.

adam bien replied on Mon, 2008/08/25 - 6:55am in response to: Slim Ouertani

[quote=slim.ouertani]

Hi adam,

EJB 3 is very interresting concept,

[/quote]

Not interesting - productive concept :-)

 [quote=slim.ouertani]

but now we start speeking about OSGI. I' am  sure that EJB will be alive for the next years even osgi are adopted by many starting projects.

[/quote]

Why not together? In Glassfish v3 it is already reality. EJB-modules could be loaded and unloaded on demand - the question is - do we need such flexitibility / dynamicisms in average enterprise project?

 

Slim Ouertani replied on Mon, 2008/08/25 - 8:09am

@ Adam

 I readed some blogs about the war between spring and JEE and declaration given by Michael Rowley (BEA) : “EJB session beans, MDBs, JAX-WS and even JMS aren’t usually necessary in an SCA universe” sayes that future will be osgi with spring DM or mixed solution EJB over osgi such as easy beans.

 

adam bien replied on Mon, 2008/08/25 - 8:40am in response to: Slim Ouertani

@Slim

 WAR? Just take the right tool for the job. EJB and Springbeans are POJOs. They can be just used together with OSGI.

Until now my customers were happy with EJB 3 - and nothing else matters:-). Wars are great for us developers, to keep our live exciting - our customers just doesn't care...

thanks!,

 

adam

 

adam bien replied on Mon, 2008/08/25 - 9:15am in response to: Slim Ouertani

[quote=slim.ouertani]

@ Adam

 I readed some blogs about the war between spring and JEE

[/quote]

The entry above is actually the only I know with more "down", than "up" dzone votes :-). Some comments are really strange - almost religious :-). The lost of objectivity is actually the beginning of the end of a developer...

Steve Hicks replied on Mon, 2008/08/25 - 9:42am in response to: adam bien

I think there is a choice that needs to be made at the beginning of developments which stack to go for. For example if I was doing a Web Application with complex web flows then I would have a choice of Spring (using Spring MVC and Spring WebFlow) and EJB3/seam/JSF.

Assuming your platform has EJB3 (not always the case) then I am interested in what factors to take account of.

 At the moment my project is can not move to EJB 3 until next year, so I am reading my Spring 2.5 books now (having done Spring 1 for over a year) but will probably look at Seam after that. 

Spring 2.5 allows for the use of annotations and I agree that having thinner XML files makes developement slicker.

I did read an article (was if by you?) on using EJB3 as backing beans for JSF in JavaSpekrum while on my hols in Austria. EJB3 certainly looks easier than EJB2 (and I did enough of that!!!)

adam bien replied on Mon, 2008/08/25 - 11:03am

@Steve

 

 Yes, it was an article written by me. Actually JSF / Seam is not that bad :-) EJB 3 are just the perfect backend for JSF - you can just inject EJBs into the backing beans...

Ashish Tiwari replied on Wed, 2008/09/03 - 12:00am

Well Nice stats !!

I am new to EJB .But EJB 3 have really been worst for me so far.I spent around 20 days to run a single program (in JBOSS 4.2.2GA).But could not not run more than "Hello world".Its really frustrating that either not  sufficient amount of tutorial is available or EJB 2.1 is easier in deploy for newbie (or lack of proper concentration) whatever so .....!

Meanwhile i posted my problems in lots of sites but the problem remained the same .

 I am always very conservative in using latest versions of frameworks or technologies .But this time it is really embarassing for me that i could not implement EJB 3 in my project because of time line or something else. 

So now i shifted to EJB 2.1 and palnning for not looking back to EJB 3.0.

 

Whether am i right ??

 

Waiting for comments ! 

 

Slim Ouertani replied on Wed, 2008/09/03 - 4:57am in response to: Ashish Tiwari

Hi,

I am not very fun with EJB 3 but trust me it's very simple than 2.1 and more productive and powerful. I spent one weekend to run EJB 2.1 with Jboss and eclipse with no success. however, if you try EJB 3 with netbeans 6 and glassfish things will be more familiar for you.

Ashish Tiwari replied on Wed, 2008/09/03 - 11:15pm in response to: Slim Ouertani

[quote=slim.ouertani]

Hi,

I am not very fun with EJB 3 but trust me it's very simple than 2.1 and more productive and powerful. I spent one weekend to run EJB 2.1 with Jboss and eclipse with no success. however, if you try EJB 3 with netbeans 6 and glassfish things will be more familiar for you.

[/quote]

well Mr Slim,

Thanks for your reply .Let me check the way as you suggest.If i succeed with that i will definately tell you.

 

 

Once again thanks for your early suggesitons . 

 

Ashish Tiwari replied on Thu, 2008/09/04 - 12:51am in response to: Ashish Tiwari

[quote=ashishjava][quote=slim.ouertani]

Hi,

I am not very fun with EJB 3 but trust me it's very simple than 2.1 and more productive and powerful. I spent one weekend to run EJB 2.1 with Jboss and eclipse with no success. however, if you try EJB 3 with netbeans 6 and glassfish things will be more familiar for you.

[/quote]

well Mr Slim,

Thanks for your reply .Let me check the way as you suggest.If i succeed with that i will definately tell you.

 

 

Once again thanks for your early suggesitons . 

 

[/quote]

 

Thanks once again !! EJB 3 is as simple as the piece of cake !!I will try to run it in JBOSS as well !!

 

Thanks a lot once again !! 

Jeroen Wenting replied on Fri, 2008/09/05 - 3:27am

why all this "EJB vs Spring"?
In my experience they work well together, giving you the best of all worlds...

So we might use an EJB3 stack exposed to a web application running remotely using a layer of Spring indirection.

Webapp doesn't know it's calling EJBs, and the EJBs are decoupled from their callers so they can change at will if need be.

Chris Hardin replied on Fri, 2010/09/17 - 9:20am

EJB 3 made things a lot better, but Spring/Hibernate combo is still light-years better. Sure you can use EJB in the stack as well, but why bother? Stick to pure Spring impl and drop the container requirement so you can run and test in Tomcat or even production in Tomcat. EJB has proven time and time again to be inefficient when compared to Spring and Hibernate couterparts.

All this being said, I used to judge the relevance of EJB by how many Job postings had it listed or how many folks I know are using it. Over the past few years, I can say I had but one potentional client tell me they were using it and I see it on about 1 out of every 25 job postings where at one point I used to see it in 1 out of every 5. On the opposite site, Spring and Hibernate postings used to be 1 in 50 and now they have risen to 1 in 5 and every client I get calls from are using aspects of each of them. 

I have to be a "code ho" but I do what the market is clamouring for. If Grails was as popular as it's proponents say it is, I'd be doing that right now... 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.