[omniORB] RE: omniorb-list-digest V1 #180

Devin Venable devin.venable@visionael.com
Mon, 31 Jul 2000 08:29:57 -0500


I've closed the Matrix so you can now make changes as needed.

Devin

-----Original Message-----
From: owner-omniorb-list-digest@uk.research.att.com
[mailto:owner-omniorb-list-digest@uk.research.att.com]
Sent: Monday, July 31, 2000 1:00 AM
To: omniorb-list-digest@uk.research.att.com
Subject: omniorb-list-digest V1 #180



omniorb-list-digest       Monday, July 31 2000       Volume 01 : Number 180



In this issue:

	[omniORB] ServantActivator problems

See the end of the digest for information about omniorb-list-digest.

----------------------------------------------------------------------

Date: Mon, 31 Jul 2000 01:48:56 -0400
From: Stefan Seefeld <seefelds@MAGELLAN.UMontreal.CA>
Subject: [omniORB] ServantActivator problems

hi,

I'm trying to run the following code but I get a runtime error 
and a CORBA::Exception in the call to poa->set_servant_manager.
What am I doing wrong ?

- --------------------------------------------------------------
#include <iostream>
#include <omniORB3/CORBA.h>

class Activator : public virtual POA_PortableServer::ServantActivator
{
public:
  Activator() {}
  virtual ~Activator() {}
  virtual PortableServer::Servant incarnate(const PortableServer::ObjectId
&oid,
					    PortableServer::POA_ptr poa)
    throw (CORBA::SystemException, PortableServer::ForwardRequest)
  {
    return 0;
  }
  virtual void etherealize(const PortableServer::ObjectId &oid,
			   PortableServer::POA_ptr poa,
			   PortableServer::Servant servant,
			   CORBA::Boolean, CORBA::Boolean)
    throw (CORBA::SystemException)
  {
    servant->_remove_ref();;
  }
};

int main(int argc, char **argv)
{
  try
    {

      CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");

      CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
      PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
      PortableServer::POAManager_var pman = root_poa->the_POAManager();
      pman->activate();

      //Create an activator servant
      Activator activator;
      PortableServer::ServantManager_var manager = activator._this();
      root_poa->set_servant_manager(manager);

      orb->run();
      orb->destroy();
    }
  catch(CORBA::SystemException&)
    {
      cerr << "Caught CORBA::SystemException." << endl;
    }
  catch(CORBA::Exception&)
    {
      cerr << "Caught CORBA::Exception." << endl;
    }
  catch(omniORB::fatalException& fe)
    {
      cerr << "Caught omniORB::fatalException:" << endl;
      cerr << "  file: " << fe.file() << endl;
      cerr << "  line: " << fe.line() << endl;
      cerr << "  mesg: " << fe.errmsg() << endl;
    }
  catch(...)
    {
      cerr << "Caught unknown exception." << endl;
    }
  return 0;
}

- --------------------------------------------------------------

the program produces the following output:

omniORB: ERROR -- A servant has been deleted that is still activated.
 repo id: 
      id: root<0>
Caught CORBA::Exception.

Any help is highly appreciated !

Regards,	Stefan

_______________________________________________________              
              
Stefan Seefeld
Departement de Physique
Universite de Montreal
email: seefelds@magellan.umontreal.ca

_______________________________________________________

      ...ich hab' noch einen Koffer in Berlin...

------------------------------

End of omniorb-list-digest V1 #180
**********************************

This digest came to you via the omniorb-list-digest mailing list.
For more information see http://www.uk.research.att.com/omniorb/intouch.html