[omniORB] Newbie having deadlock problems...

Duncan Grisby dgrisby@uk.research.att.com
Fri, 28 Apr 2000 11:37:27 +0100


On Friday 28 April, Ben Miller wrote:

> I'm new to CORBA and I've been using the 2.7.1 version of omniORB to
> work through the book "Sams Teach Yourself CORBA in 14 Days".
> However, I'm having a problem getting some of the examples to work
> properly.

Is there any particular reason that you are using omniORB 2.7.1?  Just
so you are up-to-date, I would recommend that you use either 2.8.0 or
the current 3.0 snapshot. Your problem has nothing to do with the
omniORB version, however.

> Bank* bank = new BankImpl;
> BankServerImpl_var svr;
> //... retrieve bank server object using naming service.
> ...
> //
> svr->registerBank(bank);

There are two problems with this code. The main one is that you have
not activated either the Bank object, or the BOA. The code should look
like:

  BankImpl* bank = new BankImpl;
  bank->_obj_is_ready(boa);
  boa->impl_is_ready(0,1);

Both these calls are omniORB specific, because the BOA specification
is not specific enough. You can actually use the slightly more
portable boa->obj_is_ready() function instead of
bank->_obj_is_ready(), but the code still won't be portable, so
there's not much point.

The other problem is that you are passing a pointer to your
implementation object to the registerBank() operation, when actually
you should pass an object reference. In omniORB 2.x, you actually get
away with using the implementation pointer, but that is not CORBA
compliant. In omniORB 3, it would not work. The code should look like:

  Bank_var bankref = bank->_this(); // Obtain object reference
  scr->registerBank(bankref);


I recommend that you look at the Echo examples which come in the
omniORB distribution to see how it should all look.

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --