• 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

Doubts about EJB local client view

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

I am new to EJB and preparing for the EJB 3.1 certification. I have a couple of doubts on the following:

1. If my session bean provides a local client view, does that mean local to the ear or local to the JVM. What I mean to say is that any component say a servlet in earA can it access the bean in earB within the same JVM using the local client view.

2. If my session bean provides a remote client view, then how does the remote client get to know about methods in my session bean. Also do we need to import ejb jar to the remote client, consider that my session bean is in say jboss container and the remote client in a tomcat container. How does dependency injection works in such a case considering the fact that the underlying api and the implementation would be different for different container types.

Regards,
Saurav
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Saurav,

1) This is what the specs say:
  • A local client is a client that is collocated in the same JVM.
  • Access to an enterprise bean through the local client view is only required to be supported for local clients packaged within the same application as the enterprise bean that provides the local client view.

  • 2) You will need the remote interface in your remote client (just to get an idea: have a look at the inter-ear example in my notes ch10.2) Dependency injection doesn't work when another server is involved. You will have to use the JNDI lookup (with JNDI-properties pointing at the remote server). Inter-container communication, however is not part of the EJB certification.

    Regards,
    Frits
     
    Kr Saurav
    Greenhorn
    Posts: 10
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Frits,

    Thanks for replying. I just checked your notes and got the point. However I saw that your example uses dependency injection in the remote client.

    So when you say

    Dependency injection doesn't work when another server is involved. You will have to use the JNDI lookup (with JNDI-properties pointing at the remote server).



    Another server here means a server of different container type or just another instance of the same server(say another domain of a weblogic server).

    For your example app1.ear and app2.ear, are they in same server(JVM) or they can be in different JVM's without need for a change in remote client(say JNDI lookup against DI)

    Regards,
    Saurav
     
    Frits Walraven
    Creator of Enthuware JWS+ V6
    Posts: 3411
    320
    Android Eclipse IDE Chrome
    • Likes 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Saurav,

    Kr Saurav wrote:Hi Frits,
    Another server here means a server of different container type or just another instance of the same server(say another domain of a weblogic server).


    The EJB-specs require dependency injection of an EJB to work within one EJB-container. This means that DI of an EJB in another container, whether or not it is another instance of the same container-provider, is not required. It doesn't mean that it won't be supported by EJB-container providers. JBoss has a simple way of injecting an EJB from one container into another, see this blog.

    Regards,
    Frits
     
    Kr Saurav
    Greenhorn
    Posts: 10
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Thanks Frits.

    Regards,
    Saurav
     
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic