Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[tao-users] Caught a CORBA exception: TRANSIENT (IDL:omg.org/CORBA/TRANSIENT:1.0)

236 views
Skip to first unread message

omahol

unread,
Apr 24, 2003, 4:20:12 AM4/24/03
to

Hi All,
I register the elementMgr(Client with Callback) with the Messenger
(Server). Build the files.
I start the naming service
$TAO_ROOT/orbsvcs/Naming_Service/Naming_Service -m 1 &
I then start the Server

[D:/College/Messenger/Debug] ./MessengerServer.exe
Messenger object bound in Naming Service

When I start the Client, The lisa is just a client name and sd10 is
host name.

[D:/College/Messenger/Debug] ./MessengerClient.exe lisa sd10
name lisa
address sd10
Caught a CORBA exception: TRANSIENT (IDL:omg.org/CORBA/TRANSIENT:1.0)
[D:/College/Messenger/Debug]

I know the issue is with the line in the MessengerClient File where I
register the call back because if I comment it out the Client starts
up without this error.
messenger->registerElementMgr(element_mgr.in());

Both the Client and the Server are running on the same machine

Thr following is the code for the MessengerClient and MessengerServer
files. I'd appreciate any help

MessengerClient.cpp
include "Messenger_i.h"
#include "ElementMgr_i.h"
#include <CosNamingC.h>
#include <ace/streams.h>


int
main( int argc, char *argv[] )
{
try
{
// Check the number of arguments; there should be
exactly three
if (argc != 3)
{
cout << "Usage: Element Manager Name <name>"
" Machine Address <address> " << endl;
return 1;
}

// Assign the command line arguments to the
ElementMgr attributes.
const char* mgrname = argv[1];
const char* address = argv[2];
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
// Find the Naming Service
CORBA::Object_var naming_obj = orb-
>resolve_initial_references( "NameService" );
CosNaming::NamingContext_var root =
CosNaming::NamingContext::_narrow( naming_obj.in() );
if( CORBA::is_nil( root.in() ) )
{
cerr << "Nil Naming Context reference" <<
endl;
throw 0;
}

// Resolve the Messenger object
CosNaming::Name name;
name.length( 2 );
name[0].id = CORBA::string_dup( "example" );
name[1].id = CORBA::string_dup( "Messenger" );
CORBA::Object_var obj = root->resolve( name );

// Narrow
Messenger_var messenger = Messenger::_narrow( obj.in
() );
if( CORBA::is_nil( messenger.in() ) ) {
cerr << "Not a Messenger reference" << endl;
throw 0;
}

ElementMgr_i* elementMgr = new ElementMgr_i
(messenger.in(), mgrname, address);
CORBA::Object_var poa_obj = orb-
>resolve_initial_references("RootPOA");
PortableServer::POA_var poa =
PortableServer::POA::_narrow(poa_obj.in());
PortableServer::ObjectId_var oid = poa-
>activate_object(elementMgr);
CORBA::Object_var callback_obj = poa->id_to_reference
(oid.in());
ElementMgr_var element_mgr = ElementMgr::_narrow
(callback_obj.in());
// Invoke the register operation on the Messenger.
messenger->registerElementMgr(element_mgr.in());

PortableServer::POAManager_var poa_mgr =
poa->the_POAManager();
poa_mgr->activate();

orb->run();
}
catch( const CORBA::Exception & ex ) {
cerr << "Caught a CORBA exception: " << ex << endl;
return 1;
}
catch( ... ) {
return 1;
}
cout << "Message was sent" << endl;
return 0;
}

MessengerServer.cpp
#include "Messenger_i.h"
#include <CosNamingC.h>
#include <ace/streams.h>

int
main( int argc, char *argv[] )
{
try
{
// Initialize orb
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );

//Get reference to Root POA
CORBA::Object_var obj = orb-
>resolve_initial_references( "RootPOA" );
PortableServer::POA_var poa =
PortableServer::POA::_narrow( obj.in() );

// Activate POA Manager
PortableServer::POAManager_var mgr = poa-
>the_POAManager();
mgr->activate();

// Create an object
Messenger_i messenger_servant;

// Find the Naming Service
CORBA::Object_var naming_obj =
orb->resolve_initial_references
( "NameService" );
CosNaming::NamingContext_var root =
CosNaming::NamingContext::_narrow( naming_obj.in() );
if( CORBA::is_nil( root.in() ) )
{
cerr << "Nil Naming Context reference" <<
endl;
throw 0;
}

// Bind the example Naming Context, if necessary
CosNaming::Name name;
name.length( 1 );
name[0].id = CORBA::string_dup( "example" );
try
{
CORBA::Object_var dummy = root->resolve(
name );
}
catch ( const CosNaming::NamingContext::NotFound & ) {
CosNaming::NamingContext_var dummy = root-
>bind_new_context( name );
}

// Bind the Messenger object
name.length( 2 );
name[1].id = CORBA::string_dup( "Messenger" );

PortableServer::ObjectId_var oid =
poa->activate_object( &messenger_servant );
CORBA::Object_var messenger_obj = poa->id_to_reference
( oid.in() );
root->rebind( name, messenger_obj.in() );

cout << "Messenger object bound in Naming Service" <<
endl;

// Accept requests
orb->run();
// orb->destroy();
}
catch( const CORBA::Exception & ex ) {
cerr << "Caught a CORBA exception: " << ex << endl;
return 1;
}
return 0;
}

Any ideas?

Thanks in advance

Lisa

srga...@yahoo.com

unread,
Apr 24, 2003, 10:13:04 PM4/24/03
to
In the client, try activating the poa mgr before you activate the elementmgr
object.

>On Thu, 24 Apr 2003 08:17:45 -0000 "omahol" <omahon...@emc.com> wrote.

0 new messages