Hello,
Try using a Naming service instead of passing the object reference,
its a good design.
Best Regards,
Vivekanandan M
Marek - 27 Jan 2006 21:13 GMT
> Hello,
>
[quoted text clipped - 3 lines]
> Best Regards,
> Vivekanandan M
The problem is that it ought to be done that way, because there's a software
which does
something like this:
...
SomeClassA someA =
SomeClassAHelper.narrow(remoteReferenceToATakenFromTheNameServer);
SomeClassB someB = SomeClassBHelper.narrow(someA.getB());
...
I need to write mocks for SomeClassA and SomeClassB.
Does anybody have idea how to do that?
Thanks and best regards
>>>>> "Marek" <hddoferty@wp.pl> (M) wrote:
>M> Hi,
>M> This is my problem:
>M> I have many objects that need to be accessed remotly, for example A and B.
>M> First object has method that returns reference to the second object:
[quoted text clipped - 3 lines]
>M> ...
>M> }
>M> I've implemented servants for A and B (APOA and BPOA).
>M> Method getB() returns reference made by rootPOA.servant_to_reference()
>M> and narrowed by BHelper.narrow().
>M> When I try to call some B's methods in a client application I get some null
>M> pointer exception.
>M> My question is how I should make and return reference to B by A's getB()
>M> method?
The following should work:
BPOA b = new BPOA();
b.setORB(orb);
rootPOA.activate_object(b);
return BHelper.narrow(rootPOA.servant_to_reference(b));

Signature
Piet van Oostrum <piet@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: piet@vanoostrum.org