File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes EJB Accessibility 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 Accessibility" Watch "EJB Accessibility" New topic
Author

EJB Accessibility

Sai Surya
Ranch Hand

Joined: Feb 08, 2006
Posts: 459

I think I am confused with the way we access the EJB in various circumstances. The following is my understaning so far. Please validate my understanding and correct me if I am wrong.


1. Invoking an EJB located in a remote server from stand along Java client.

I cannot use @EJB annotation since there is no way for remote server's container
to inject dependency. So I need to use ACC to access an EJB located in a remote server.
I need to follow traditional JNDI look up to get a reference to the remote EJB.


2. Invoking an EJB located in a remote server from web application running on different server.

<same as above>

3. Invoking an EJB located in a remote server from a web application in a distrubuted environment.

In this case, since the environment is distrubuted, I can use DI (@EJB annotation) to
access EJB located in a remote server.


4. Invoking an EJB from any web application deployed in the same server and host.

I can use DI (@EJB) and it is straightforward approach.


am I correct?


Sai Surya, SCJP 5.0, SCWCD 5.0, IBM 833 834
http://sai-surya-talk.blogspot.com, I believe in Murphy's law.
James Joshy
Greenhorn

Joined: Jun 04, 2009
Posts: 6
Sai Surya wrote:

1. Invoking an EJB located in a remote server from stand along Java client.

I cannot use @EJB annotation since there is no way for remote server's container
to inject dependency. So I need to use ACC to access an EJB located in a remote server.
I need to follow traditional JNDI look up to get a reference to the remote EJB.


I agree



2. Invoking an EJB located in a remote server from web application running on different server.

<same as above>


I agree



3. Invoking an EJB located in a remote server from a web application in a distrubuted environment.

In this case, since the environment is distrubuted, I can use DI (@EJB annotation) to
access EJB located in a remote server.

What is the definition of 'distributed environment' (apart from 'remote server' ) ?
Injection can be done by hosting container only, not remote container.
@EJB is nothing but , a) Create InitialContext and then b) JNDI lookup . Unless the EJB is registered (like a resource) in JNDI context of the webcontainer, how would it inject it ?




4. Invoking an EJB from any web application deployed in the same server and host.

I can use DI (@EJB) and it is straightforward approach.

am I correct?

agree since EJB is in container naming context


SCJP, SCJD, SCBCD-5
Sai Surya
Ranch Hand

Joined: Feb 08, 2006
Posts: 459

Thanks for the reply Joshy. So even in distributed environment DI will not work. Things seems clearer after re-reading.
 
 
subject: EJB Accessibility