| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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 |
|
#2
| |||
| |||
| 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()? |
|
#3
| |||
| |||
| >>>>> 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 |
|
#4
| |||
| |||
| > 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 |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.