my dog learned polymorphism*
The moose likes EJB and other Java EE Technologies and the fly likes @EJB injection question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "@EJB injection question" Watch "@EJB injection question" New topic
Author

@EJB injection question

Jazon Din
Greenhorn

Joined: Jun 28, 2009
Posts: 3
Hello again.

I recently viewed duke' bank application which was developed using @EJB annotation.
Also, As i know @EJB injection can be done only in main class.

What if i don't want to write all the bussiness logic and components , events discription/ initializations in one class?

I mean, i want to separate them into 3 different classes like here:

http://java.sun.com/developer/technicalArticles/J2EE/appclient/

graphics.java , dataHandler, eventHandler and so on..

and not to do like here:



...



QUESTION : how i can call remote session bean methods with @EJB from class different from main if it is not allowed? I tryed to make references to main class but failed with NullPointerException... ))


Should i use EJB 2.1 insted of 3.0 then?i am really confused.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

You can use a JNDI lookup if injection isn't working...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @EJB injection question
 
Similar Threads
@PersistenceContext - overriding injection using configuation file.
@EJB
Need to use a bean inside static block of another bean
Why does Eclipse 3.1.0 show these 2 warnings? any work arounds
Calling a Injected EJB in child class using @EJB on GlassFish result in a NullPointerException