jQuery in Action, 3rd edition
The moose likes EJB and other Java EE Technologies and the fly likes @EJB injection from different jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "@EJB injection from different jar" Watch "@EJB injection from different jar" New topic

@EJB injection from different jar

Mattia Battiston

Joined: Mar 23, 2009
Posts: 7
I'm having a problem with EJB injection, hopefully someone here will be able to help me.

I've got a jar with an EJB in there; this is its code:

From other classes in the same jar I can inject it simply like this:

Here comes the problems: I'm actually deploying this jar in an ear, and in this ear I've also got a war with some JSF pages and related java backing beans.
What I want to do is to inject my TravelAgentBean in a page's backing bean (e.g. CreateCabinBackingBean), but the same code as above doesn't work:

However, this code works:

I'm deploying on Jboss 4.2.2. I'm quite new both with JSF and EJB, so probably there's something I'm missing...can someone please give me an advice on how to make the dependency injection work?

Thank you very much

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

See this JavaRanch post for why it doesn't work in JBoss for JSF.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Mattia Battiston

Joined: Mar 23, 2009
Posts: 7
ok, that's clear now, thank you very much. Mattia
I agree. Here's the link: http://aspose.com/file-tools
subject: @EJB injection from different jar
It's not a secret anymore!