Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 11:00

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



CORBA - impl problem

Discussion on CORBA - impl problem within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
XxharCs's Avatar
 
elite*gold: 34
Join Date: Apr 2011
Posts: 1,475
Received Thanks: 1,228
CORBA - impl problem

Hallo!

Habe vor kurzem begonnen CORBA zu lernen (eig. im Unterricht mit CORBA begonnen) und ich gehe grad ein User Guide durch welches von omniORB selbst zur Verfügung gestellt wurde. ()

(Verwendet wird omniORB-4.1.7 für die C++ implementation)

Soweit so gut, bin aber bei der Server Implementation aus irgendwelchen Gründen stehen geblieben

Bekomme diesen Fehler wenn ich es ausführe:
Code:
./echo_ServImpl 
IOR:010000000d00000049444c3a4563686f3a312e300000000001000000000000006800000001010200100000003139322e3136382e3138322e3132380039af00000e000000fe1cdace52000075a0000000000000000200000000000000080000000100000000545441010000001c00000001000000010001000100000001000105090101000100000009010100
Caught CORBA::TRANSIENT
Ich verstehe die Fehlermeldung nicht genau bzw. so ein Fehler wird nicht wirklich im user guide angesprochen.. oder ich übersehe es einfach
Also das: Caught CORBA::TRANSIENT, ist die Fehlermeldung, IOR ignorieren, ist dazu da, damit sich dann der Client verbinden kann.

Das ist mein Code:
Code:
#include <echo.hh>

#ifdef HAVE_STD
#  include <iostream>
   using namespace std;
#else
#  include <iostream.h>
#endif

static CORBA::Boolean bindObjectToName(CORBA::ORB_ptr, CORBA::Object_ptr);


class Echo_i : public POA_Echo
{
public:
  inline Echo_i() {}
  virtual ~Echo_i() {}
  virtual char* echoString(const char* mesg);
};


char* Echo_i::echoString(const char* mesg)
{
  return CORBA::string_dup(mesg);
}

//////////////////////////////////////////////////////////////////////

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

    CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
    PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);

    Echo_i* myecho = new Echo_i();

    PortableServer::ObjectId_var myechoid = poa->activate_object(myecho);

    obj = myecho->_this();

    CORBA::String_var x;
    x = orb->object_to_string(obj);
    cout << x << endl;

    if( !bindObjectToName(orb, obj) )
      return 1;

    myecho->_remove_ref();

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

    orb->run();
  }
  catch(CORBA::SystemException& ex) {
    cerr << "Caught CORBA::" << ex._name() << endl;
  }
  catch(CORBA::Exception& ex) {
    cerr << "Caught CORBA::Exception: " << ex._name() << 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;
  }
  return 0;
}

//////////////////////////////////////////////////////////////////////

static CORBA::Boolean bindObjectToName(CORBA::ORB_ptr orb, CORBA::Object_ptr objref)
{
  CosNaming::NamingContext_var rootContext;

  try {
    
    CORBA::Object_var obj;
    obj = orb->resolve_initial_references("NameService");

    
    rootContext = CosNaming::NamingContext::_narrow(obj);
    if( CORBA::is_nil(rootContext) ) {
      cerr << "Failed to narrow the root naming context." << endl;
      return 0;
    }
  }
  catch (CORBA::NO_RESOURCES&) {
    cerr << "Caught NO_RESOURCES exception. You must configure omniORB with the location" << endl
	 << "of the naming service." << endl;
    return 0;
  }
  catch (CORBA::ORB::InvalidName&) {
    
    cerr << "Service required is invalid [does not exist]." << endl;
    return 0;
  }

  try {
    

    CosNaming::Name contextName;
    contextName.length(1);
    contextName[0].id   = (const char*) "test";       
    contextName[0].kind = (const char*) "my_context"; 
    

    CosNaming::NamingContext_var testContext;

    try {
      
      testContext = rootContext->bind_new_context(contextName);
    }
    catch(CosNaming::NamingContext::AlreadyBound& ex) {
      
      CORBA::Object_var obj;
      obj = rootContext->resolve(contextName);
      testContext = CosNaming::NamingContext::_narrow(obj);
      if( CORBA::is_nil(testContext) ) {
        cerr << "Failed to narrow naming context." << endl;
        return 0;
      }
    }

    
    CosNaming::Name objectName;
    objectName.length(1);
    objectName[0].id   = (const char*) "Echo";   
    objectName[0].kind = (const char*) "Object"; 

    try {
      testContext->bind(objectName, objref);
    }
    catch(CosNaming::NamingContext::AlreadyBound& ex) {
      testContext->rebind(objectName, objref);
    }
    
  }
  catch(CORBA::TRANSIENT& ex) {
    cerr << "Caught system exception TRANSIENT -- unable to contact the naming service." << endl
	 << "Make sure the naming server is running and that omniORB is configured correctly." << endl;

    return 0;
  }
  catch(CORBA::SystemException& ex) {
    cerr << "Caught a CORBA::" << ex._name()
	 << " while using the naming service." << endl;
    return 0;
  }
  return 1;
}
Ich weiß nicht ob sich jemand von euch schon mit CORBA beschäftigt hat, aber ich hoffe mal um hilfe

Edit: Ich arbeite unter Linux (Debian um genauer zu sein)
XxharCs is offline  
Reply


Similar Threads Similar Threads
[Problem]Habe ein Problem und zwar spinnt mein VPC etwas(ohne Grund)?!
07/28/2011 - Metin2 Private Server - 10 Replies
Also wie schon gesagt meins Server spinnt wodurch kiks usw. kommen :( ich lade euch die Screens in den Anhang, mit der Hoffnung, dass ihr mir helfen könnt :) wäre echt sehr nice :)



All times are GMT +1. The time now is 11:00.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.