javax.ejb.EJB versus javax.annotation.EJB

Oh my, I feel it's quite tough to get started with an EJB 3 project.
I spent an hour trying to get dependency injection on JBoss to work.

Finally, it turned out that I incorrectly used the @EJB annotation from
javax.ejb.EJB which is packaged with Idea's javaee.jar
It only works when using
javax.annotation.EJB from the jboss-2jb3x.jar

What's going on here, has something changed lately and Idea has not
yet caught up?

1 comment

Stephen Kelvin wrote:

Oh my, I feel it's quite tough to get started with an EJB 3 project.
I spent an hour trying to get dependency injection on JBoss to work.

Finally, it turned out that I incorrectly used the @EJB annotation from
javax.ejb.EJB which is packaged with Idea's javaee.jar
It only works when using
javax.annotation.EJB from the jboss-2jb3x.jar

What's going on here, has something changed lately and Idea has not
yet caught up?


Well, EJB 3 specification is in PFD state now and
it says javax.ejb.EJB is the right annotation.
(ejb-3_0-pfd-spec-simplified.pdf#chapter 10 foreword and section 10.10)

GlassFish project is going to be Java EE RI and for sure it is
in beta state.

IDEA bundle contains javaee.jar from GlassFish distribution
and I try to keep it up to date.

However if you stuck with JBoss then JBoss rules are the rules.
When the spec go final all implementations will use the same javaee.jar
eventually :)

BTW javax.annotation package is proposed by "Common Annotations" spec
which is another story and I personally doubt that EJB will ever be there.


Gregory


0

Please sign in to leave a comment.