• 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

EJB Accessibility

 
Ranch Hand
Posts: 463
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
No matter. Try again. Fail again. Fail better. This time, do it with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic