*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes @Ejb annotation does not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "@Ejb annotation does not work" Watch "@Ejb annotation does not work" New topic
Author

@Ejb annotation does not work

vijayakrishna Mikkilineni
Greenhorn

Joined: Nov 10, 2009
Posts: 24
I completed SCJP in December 2009 and after a long time i decided to take SCBCD exam. I am reading "EJB 3 in action" and writing code in Eclipse and using JBoss. I started with "Hello world" but I have difficulty working on @EJB annotation for Dependency injection. Can some one tell me how to make it work?


Vijayakrishna M
Udara Amarasinghe
Ranch Hand

Joined: Aug 17, 2009
Posts: 109

Hi friend,

@EJB annotation can use to inject server side beans such as Stateless, Stateful or MessageDriven into a another server side bean such as java server side application client, another EJB or or web components like servlets, JSP. But you can't use @EJB annotation in a not server side java application. Therefore you have to use JNDI lookup to inject server side beans into non server side java applications.

So vijayakrishna in your case we can't figure out what you are going to inject using @EJB. So if you post your code it will be easy to figure out what the problem is.
Romeo Son
Ranch Hand

Joined: Mar 12, 2007
Posts: 92

You can use also the @EJB annotation to inject an EJB3 bean reference in a client java application, if you run it in ACC (Aplication Client Container) that comes for example with GlassFish.


SCJP 1.4, SCJD, OCE EJBD 6
 
Don't get me started about those stupid light bulbs.
 
subject: @Ejb annotation does not work
 
Similar Threads
Is the statement about EJB 3.x right?
@Startup annotation
How to access session bean within another session bean ?
EJB injection doesn't work in JSF Convertor
difference between annotations