• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to inject one EJB into another EJB in the same application

 
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody!

[size=12]I am developing simple application to understand better JMS. It turned out that I know very little of EJB injection too.
I am desperate after this day trying to inject one Message-Driven Bean into another stateful bean. Each attempt to deploy my app I have only mistakes. As I remember the first mistake of this was NameNotFoundException and after that long range of Exception subclasses.
Here is my mdb which has to be injected into another bean within the same folder even:

Here is my ejb that injects above mdb:


I have tried all possible attributes from @EJB. I tried to change web.xml as I found on the Internet. What I found is here:

Unfortunately this piece of code only encreased range of my mistakes! Also I tried to add there <lookup-name> element, then <mapped-name> but vainly!

Can anybody advise me what to set in my web.xml or EJBs to have my MDB injected into my stateful bean. I tried also to change stateful bean to stateless but it didn't make any difference! I tried to move from @EJB to @Resource annotation but it didn't help too.

Thank you very much for any ideas!
[/size]
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I know it is not possible to inject MDB instance into another bean because MDB are invisible for the clients. You can only get a reference to a Queue or Topic the MDB is listening.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic