[omniORB] "A Servant has been deleted that is still activated"
Read, Gordon
Gordon.Read@Aspentech.com
Tue, 22 May 2001 15:56:14 +0100
Hello
At this point I have to admit that I am a complete "newbie" with
CORBA/omniORB, though I have already searched the web (and omniORB
documentation) for an answer to this question, but to no avail.
The company I work for recently upgraded from omniORB 2.8 to omniORB 3.0.3,
the following code worked ok with omniORB 2.8, but gives an error "A Servant
has been deleted that is still activated" (from the destructor of
omniServant) when run using omniORB 3.0.3. It is the policy of the company
that I am working for to keep working with a BOA (as opposed to changing to
using POA) until some time in the future, yet to be decided. What am I doing
wrong in the code? (or what am I missing?)
The example was compiled and tested on HPUX (version 11) and an Alpha
running Compaq TRU64 unix with the same problem.
Many thanks
Gordon Read
idl.idl:
#ifndef idl_idl
#define idl_idl
interface Example
{
};
#endif
compiled using the following command line:
omniidl -bcxx -WbBOA -Wbh='.h' -Wbs='.cxx' idl.idl
main program: (example.cxx)
#include <iostream.h>
#include "idl.h"
CORBA::BOA_ptr boa;
CORBA::ORB_ptr orb;
class MyExample : virtual public _sk_Example {
public:
MyExample();
virtual ~MyExample();
};
//
----------------------------------------------------------------------------
-
MyExample::MyExample()
: _sk_Example() {
cout << "MyExample::MyExample()" << endl;
_obj_is_ready(boa);
}
MyExample::~MyExample() {
cout << "MyExample::~MyExample()" << endl;
}
//
----------------------------------------------------------------------------
-
int main(int argc, char** argv) {
orb = CORBA::ORB_init(argc, argv,"omniORB3");
if ( orb )
boa = orb->BOA_init(argc,argv,"omniORB3_BOA");
cout << "about to do: MyExample* theExample = new MyExample;" << endl;
MyExample* theExample = new MyExample;
cout << "about to do: delete theExample;" << endl;
delete theExample;
cout << "about to do: return 0;" << endl;
return 0;
}
When run, the following output is produced:
about to do: MyExample* theExample = new MyExample;
MyExample::MyExample()
about to do: delete theExample;
omniORB: ERROR -- A servant has been deleted that is still activated.
id: boa<0x3b0a7b8b71f8d9f100000001>
MyExample::~MyExample()
about to do: return 0;