• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Local/Remote interface

 
roul ravashimka
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all,
is the interaction between a servlet and a EJB possible by using the local interface of the ejb, of do you alwyas have to use the remote interface?

I hope someone could help me,
Roul
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34965
377
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roul,
We just had this question at work yesterday. Sun says that it is possible to use the local interface between servlets and EJBs but not recommended.
 
roul ravashimka
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for your input,
but why isn't it recommended?
Roul
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34965
377
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't find the sun link, but here is one from ibm and a discussion on the server side.
 
sam bos
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There seems to be a logical reasoning behind it since.
You may use the local ref to remote object if the servlets are residing in the same JVM as your ejbs which ofcourse will give you a performance boost but what if you decided to scale your application by adding more processors in a cluster.
Your servlet container and ejb container both can reside on different machines in a cluster and obviously your ejbs cannot be local to your servlets.
I may be wrong but this is what i think.
-sam
 
Roland Barcia
author
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Calling an EJB with the local interface from the Web Container is possible.
I recomend it. It is a matter of performance versus location transperency. I would choose performence since you will have the EJB and Web in the same layer most of the time anyway.
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Roland Barcia:
Calling an EJB with the local interface from the Web Container is possible.
I recomend it. It is a matter of performance versus location transperency. I would choose performence since you will have the EJB and Web in the same layer most of the time anyway.

I am curious how EJB and Servlet can be in the same layer(in the sense of clustered environment). They may look like that since they are both on the server side, but they both can be on two different virtual machines. But for a user they may seem virtually on the same layer(server side) but on two different JVMs. Only in small scale J2EE systems they are sitting on the same box, I would say.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kishore Dandu:

I am curious how EJB and Servlet can be in the same layer(in the sense of clustered environment). They may look like that since they are both on the server side, but they both can be on two different virtual machines. But for a user they may seem virtually on the same layer(server side) but on two different JVMs. Only in small scale J2EE systems they are sitting on the same box, I would say.

Hogwash. In MOST large-scale J2EE systems (and I mean of the scale of Schwab, eBay, etc...) the Servlet and EJB containers are co-resident in the same JVM. We at IBM have been recommending this for several years. It's MUCH faster, and just as scalable as using a multi-tier system where you separate the Web and EJB containers. Yes, that's different from "Accepted wisdom", but in fact, we have the numbers and performance tests within IBM to back it up. In this case, the accepted wisdom is flat-out wrong.
Kyle
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kishore Dandu:
Only in small scale J2EE systems they are sitting on the same box, I would say.

Absolutely wrong. Most large-scale J2EE deployments co-locate the EJB and Web tiers in the same JVM in the form of an Enterprise Application. This is the main motivation for standardizing EAR deployments in the J2EE 1.3 Specification. When large systems need to scale horizontally then the application is replicated across all nodes in the cluster.
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chris Mathews:

Absolutely wrong. Most large-scale J2EE deployments co-locate the EJB and Web tiers in the same JVM in the form of an Enterprise Application. This is the main motivation for standardizing EAR deployments in the J2EE 1.3 Specification. When large systems need to scale horizontally then the application is replicated across all nodes in the cluster.

So, what you guys are saying is, when there is clustering and there is a failover; the new jvm that takes the responsibility of serving the EJB and servlet will be the same. OK.
So, from 1.3 spec on; does that mean many large scale J2EE implementations are served by single JVM; before and after a failover???
 
Roland Barcia
author
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not exactly sure what you are referring to with serving, but you should look at it as the application (as a whole) is failing over. Issues with failover has to do with State Management. The fact that a Bean class or a Servlet are loaded in the same VM and are servicing the same client is different?
 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using local interfaces currently between my BusinessDelegates (webtier) and my SLSBs (EJBtier). But I want my BusinessDelegate code to easily switch from one to the other. I want to set a property in Ant (not sure where, web.xml ?) and then have that propagate to the delegates. Any suggestions?
Pho
 
Roland Barcia
author
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I never liked the idea of having the Remote/Local interfaces being a programmatic decision, I think this made the spec more complex for the client. Using some type of smart delegate is defintley that hides the details of weather it is local or remote is definitely adivisable. The spec should have made this a deployment decision and not a programmatic one.
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Roland Barcia:
I never liked the idea of having the Remote/Local interfaces being a programmatic decision, I think this made the spec more complex for the client. Using some type of smart delegate is defintley that hides the details of weather it is local or remote is definitely adivisable. The spec should have made this a deployment decision and not a programmatic one.

may be that is why IBM websphere is lagging in technology compared to Weblogic (since some who are working for IBM don't agree a lot with the spec). This is just a joke.
 
Roland Barcia
author
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BEA sees this as a limitation as well. Thus why we are co-authoring the SDO spec together to bring a common client model for multiple data sources.
 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roland,
What does SDO mean actually ?
Pho
 
Roland Barcia
author
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Service Data Object
http://www.jcp.org/en/jsr/detail?id=235
http://www-106.ibm.com/developerworks/java/library/j-commonj-sdowmt/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic