• 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

Question related to Application Server and Container

 
Ranch Hand
Posts: 211
Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My understanding of how mostly all app-servers work is that they have a separate container for web components and a separate container for ejb component.
Now my query is lets take Local view in EJB for example . The basic semantics that Local view follows is Call by reference ,so that makes sense that if a client needs to access a service with a local view , both the client and the service needs to be in same JVM . But now if my web component which is running on a web container need to access the ejb service running on EJB container it is compulsory for the web component to use the remote view. So is my understanding correct that each container have their own Jvm though on a single server machine ??

Q2) Another doubt i have is that why EJB spec have stated the following rule as compulsion with local view ,
if my client (ejb) and service (ejb) and if both of them are packaged in separate EJB archive then local view is not possible . Why so ?? why both the client and the service needs to be a part of a single Ear file because in this example both client and service is an EJB so they will go in the same container and hence same JVM , so it does not matter whether it is same Ear or different Ear . Can some one clear my above 2 doubts ?


Regards,
Shroff.
 
Ranch Hand
Posts: 49
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your questions are kinda related. So I'll try to answer at once.

In app server, you are dealing with different Class Loaders, not different JVMs. Each application has its own class loader. So if you package your web application's war file and EJB's jar in one "ear" file and deploy the whole thing as one application, since both are using the same class loader, they are in each other's sight and thus a local interface will suffice (in that case you can use Dependency Injection to, for example, inject your EJBs onto your Servlets). If you deploy them separately though, they'll be separate applications. Then the only way these classes can find each other is through JNDI. JNDI uses remote interface to generate the Binding Name.

Does this help?
 
Sagar Shroff
Ranch Hand
Posts: 211
Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Amir Keibi wrote:Your questions are kinda related. So I'll try to answer at once.

In app server, you are dealing with different Class Loaders, not different JVMs. Each application has its own class loader. So if you package your web application's war file and EJB's jar in one "ear" file and deploy the whole thing as one application, since both are using the same class loader, they are in each other's sight and thus a local interface will suffice (in that case you can use Dependency Injection to, for example, inject your EJBs onto your Servlets). If you deploy them separately though, they'll be separate applications. Then the only way these classes can find each other is through JNDI. JNDI uses remote interface to generate the Binding Name.

Does this help?


Thank you for your answer .
So my first point was wrong right ? I thought that the only way a web component can access an ejb component is through a remote view, it can also be accesed using local view if they are packaged as a single EAR ? right ?

Regards,
Shroff
 
Amir Keibi
Ranch Hand
Posts: 49
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) Yes and 2) Yes.

This is from EJB 3.1's spec (JSR-318):

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.
Compliant implementations of this specification may optionally support access to the local client view of an enterprise bean from a local client packaged in a different application. The configuration requirements for inter-application access to
the local client view are vendor-specific and are outside the scope of this specification. Applications relying on inter-application access to the local client view are non-portable.




This means, there might be some application servers that use local interface to access an EJB from another application in the same application server instance. Even if that's the case, if you deploy your EJB and its client as two separate applications you should always provide remote interface.
 
Sagar Shroff
Ranch Hand
Posts: 211
Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Amir Keibi wrote:
This means, there might be some application servers that use local interface to access an EJB from another application in the same application server instance. Even if that's the case, if you deploy your EJB and its client as two separate applications you should always provide remote interface.


Thanks a lot

Regards,
Shroff
 
Stinging nettles are edible. But I really want to see you try to eat this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic