• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

does the stub depend on the client location?

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suppose I have a remote Client R and two remote ejb A and B. A and B are remote as well.

I have a business method in A like this:

BRemote getB () throws RemoteException {
Context ct = new InitialContext ();
HomeB hb = (HomeB) PortableRemoteObject.narrow ( ct.lookup ( "java:comp/env/B" ), HomeB.class );
BRemote rb = hb.create ();
return rb;
}

Then in client R:
void doSth () throws RemoteException {
//after get Remote component reference for A, ar
BRemote br = ar.getB ();
br.callBussinessMethod ();
}

Would the above code work?
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...two remote ejb A and B. A and B are remote as well.
Not sure what you mean by that...
 
Jingyi Wang
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I mean ejb A and ejb B are not in the same heap.
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's what I thought

Then it's the same problem as described here, I guess...
 
Jingyi Wang
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, we have three objects: ejb A, ejb B and client R. R is remote to A and B, A and B are not on the same heap ( Remote each other ).
Suppose I have a buiness method in ejb A:

// in ejb A, get remote component interface reference of B
public BRemote getB () throws RemoteException {
Context cxt = new InitialContext ();
Object o = cxt.lookup ( "java:comp/env/ejb/B" );
BHome bh = (BHome) PortableRemoteObject.narrow ( o, BHome.class );
BRemote br = bh.create ();
return br;
}

// in client R
public void doSth () throws RemoteException {
Context cxt = new InitialContext ();
Object o = cxt.lookup ( "java:comp/env/ejb/A" );
AHome ah = (AHome) PortableRemoteObject.narrow ( o, AHome.class );
ARemote ar = ah.create ();
BHome br = ar.getB (); // call ejb A's buiness method to get B's
// component interface reference
br.callSomeBusinessMethod (); // does work here?
}
 
Jingyi Wang
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks
 
What does a metric clock look like? I bet it is nothing like this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic