Problem with POATie and _this()

This is a discussion on Problem with POATie and _this() within the Object forums in Theory and Concepts category; Does anybody know why this crashes? IDL: module HelloApp{ interface Hello{ string sayHello(); Hello another(); }; }; class HelloImpl extends HelloPOA{ public String sayHello(){ return "Hello Corba World !!"; } public Hello another() { HelloImpl newhello = new HelloImpl(); HelloPOATie tie = new HelloPOATie(newhello); Hello href = tie._this(HelloServer.orb); try { System.out.println("Server:"+href.sayHello()); } catch (Exception e) { System.out.println(e); } return href; } } When A Hello object is created after the orb.run() in teh server (e.g. by a client that calls another() on an existing Hello object, the server gets an exception on the embedded sayHello() call. This does not happen ...

Go Back   Application Development Forum > Theory and Concepts > Object

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 04-03-2004, 01:02 PM
Piet van Oostrum
Guest
 
Default Problem with POATie and _this()

Does anybody know why this crashes?

IDL:
module HelloApp{
interface Hello{
string sayHello();
Hello another();
};
};

class HelloImpl extends HelloPOA{

public String sayHello(){
return "Hello Corba World !!";
}

public Hello another() {
HelloImpl newhello = new HelloImpl();
HelloPOATie tie = new HelloPOATie(newhello);
Hello href = tie._this(HelloServer.orb);
try {
System.out.println("Server:"+href.sayHello());
} catch (Exception e) {
System.out.println(e);
}
return href;
}
}

When A Hello object is created after the orb.run() in teh server (e.g. by
a client that calls another() on an existing Hello object, the server gets
an exception on the embedded sayHello() call. This does not happen when a
Hello object is created before the orb.run().

When the Hello href = tie._this(HelloServer.orb); code is replaced by:

Hello href = null;
try {
href = HelloHelper.narrow(HelloServer.rootpoa.servant_to_ reference(tie));
} catch (Exception e) {
}

it works.
So what is wrong with _this()?
--
Piet van Oostrum <piet@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum@hccnet.nl
Reply With Quote
  #2  
Old 04-06-2004, 07:08 PM
Bill Lloyd
Guest
 
Default Re: Problem with POATie and _this()

Implicit activation has many pitfalls. Are you only using one (the
root) POA? Because you probably activated your object somewhere other
than you thought you did.

I'd suggest explicit activation, always. If the wee Mr. Kelly's
around, he'll give you more details ;-)

On 2004-04-03 10:02:55 -0800, Piet van Oostrum <piet@cs.uu.nl> said:

> Does anybody know why this crashes?
>
> IDL:
> module HelloApp{
> interface Hello{
> string sayHello();
> Hello another();
> };
> };
>
> class HelloImpl extends HelloPOA{
>
> public String sayHello(){
> return "Hello Corba World !!";
> }
>
> public Hello another() {
> HelloImpl newhello = new HelloImpl();
> HelloPOATie tie = new HelloPOATie(newhello);
> Hello href = tie._this(HelloServer.orb);
> try {
> System.out.println("Server:"+href.sayHello());
> } catch (Exception e) {
> System.out.println(e);
> }
> return href;
> }
> }
>
> When A Hello object is created after the orb.run() in teh server (e.g. by
> a client that calls another() on an existing Hello object, the server gets
> an exception on the embedded sayHello() call. This does not happen when a
> Hello object is created before the orb.run().
>
> When the Hello href = tie._this(HelloServer.orb); code is replaced by:
>
> Hello href = null;
> try {
> href = HelloHelper.narrow(HelloServer.rootpoa.servant_to_ reference(tie));
> } catch (Exception e) {
> }
>
> it works.
> So what is wrong with _this()?



Reply With Quote
  #3  
Old 04-07-2004, 05:27 AM
Piet van Oostrum
Guest
 
Default Re: Problem with POATie and _this()

>>>>> Bill Lloyd <no.emails.thanks@foo.com> (BL) wrote:

BL> Implicit activation has many pitfalls. Are you only using one (the root)
BL> POA? Because you probably activated your object somewhere other than you
BL> thought you did.

BL> I'd suggest explicit activation, always. If the wee Mr. Kelly's around,
BL> he'll give you more details ;-)

The code I gave was most of the example, except for the main() method. No
other POA's were created. I tried the example again yesterday, and it
worked!! The difference appears that now I was connected to the network
and the first time I wasn't. So apparently _this() is sensitive to a
network connection, whereas servant_to_reference() is not. Strange.
Anyway, I came with this problem because some of my students had a similar
problem, but they were connected to the network. And still switching from
_this() to servant_to_reference() solved their problem.
--
Piet van Oostrum <piet@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum@hccnet.nl
Reply With Quote
  #4  
Old 04-07-2004, 09:06 AM
Brian Kelly
Guest
 
Default Re: Problem with POATie and _this()

> BL> Implicit activation has many pitfalls. Are you only using one (the root)
> BL> POA? Because you probably activated your object somewhere other than you
> BL> thought you did.
>
> BL> I'd suggest explicit activation, always. If the wee Mr. Kelly's around,
> BL> he'll give you more details ;-)
>
> The code I gave was most of the example, except for the main() method. No
> other POA's were created. I tried the example again yesterday, and it
> worked!! The difference appears that now I was connected to the network
> and the first time I wasn't. So apparently _this() is sensitive to a
> network connection, whereas servant_to_reference() is not. Strange.
> Anyway, I came with this problem because some of my students had a similar
> problem, but they were connected to the network. And still switching from
> _this() to servant_to_reference() solved their problem.


Here are the details Bill was referring to:

http://www.iona.com/support/articles/2319.93.xml

Hope this helps,
Brian
IONA Technologies
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 07:41 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.