Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB Accessibility

 
Sai Surya
Ranch Hand
Posts: 463
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
James Joshy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sai Surya
Ranch Hand
Posts: 463
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Joshy. So even in distributed environment DI will not work. Things seems clearer after re-reading.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic