• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Different ways of dependency injection

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have a question about Context lookups and dependency Injection regarding the following scenario:

I'm using JBoss 6, JSF 2.0, EJB 3.1
I have and ejb jar and a war archive packaged together in an ear.
My ejb-jar contains a stateless, no interface session bean.
My war has a session scoped managed bean.

Inside my managed bean, I use the EJB annotation to inject an instance of my no-interface session bean - works like a charm!
When I deploy the ejb-jar and the war archives separately (without the ear) I get an error, stating that "Could not resolve @EJB reference ... ". However when I remove the EJB annotation in my managed bean and do a "InitialContext.doLookup("..."), I get NO errors and everything is fine.

Why doesn't dependency Injection using the EJB annotation work when deploying the artifacts sepeparately but a manual lookup does?
(I first deploy my ejb-jar and afterwards I deploy the war.)

Does anyone have a clue?
 
I'm full of tinier men! And a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic