[omniORB] Newbie omniORB problem; unknown system exception?
Stephen Hansen
shansen at advpubtech.com
Tue May 11 15:53:37 BST 2004
Hello all.
I'm trying to see if omniORB will work in our project, and have run into
a bit of a snag. I'm using omniORB and omniORBpy to talk back and forth
between a couple different applications. For right now i have something
very simple in place:
module FalconLayout {
interface LayoutAgent {
unsigned short GetDocumentCount();
};
};
That's all :) My C++ code, in Visual C++ 7.1, which is mostly just from
the boilerplate example produced by omniidl:
----------------------------------------------------------
#include <iostream>
#include <fstream>
#include "FalconLayout.h"
using namespace std;
ofstream err("c:\\corba.error");
class FalconLayout_LayoutAgent_i: public POA_FalconLayout::LayoutAgent,
public PortableServer::RefCountServantBase {
private:
public:
FalconLayout_LayoutAgent_i();
virtual ~FalconLayout_LayoutAgent_i();
CORBA::UShort GetDocumentCount();
};
FalconLayout_LayoutAgent_i::FalconLayout_LayoutAgent_i(){}
FalconLayout_LayoutAgent_i::~FalconLayout_LayoutAgent_i(){}
CORBA::UShort FalconLayout_LayoutAgent_i::GetDocumentCount(){
return CORBA::UShort(33);
}
CORBA::ORB_var globalOrb;
void runOrb() {
try {
char* emptylist = {"editpag"};
int count = 0;
globalOrb = CORBA::ORB_init(count, &emptylist);
CORBA::ORB_var orb = globalOrb;
CORBA::Object_var obj =
orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa =
PortableServer::POA::_narrow(obj);
FalconLayout_LayoutAgent_i* myFalconLayout_LayoutAgent_i
= new FalconLayout_LayoutAgent_i();
PortableServer::ObjectId_var
myFalconLayout_LayoutAgent_iid =
poa->activate_object(myFalconLayout_LayoutAgent_i);
{
CORBA::Object_var ref =
myFalconLayout_LayoutAgent_i->_this();
CORBA::String_var
sior(orb->object_to_string(ref));
cout << "IDL object FalconLayout::LayoutAgent
IOR = '" << (char*)sior << "'" << endl;\
ofstream outf("c:\\ref.ref");
outf << (char*)sior;
}
PortableServer::POAManager_var pman =
poa->the_POAManager();
pman->activate();
}
catch(CORBA::SystemException&) {
err << "Caught CORBA::SystemException." << endl;
}
catch(CORBA::Exception&) {
err << "Caught CORBA::Exception." << endl;
}
catch(omniORB::fatalException& fe) {
err << "Caught omniORB::fatalException:" << endl;
err << " file: " << fe.file() << endl;
err << " line: " << fe.line() << endl;
err << " mesg: " << fe.errmsg() << endl;
}
catch(...) {
err << "Caught unknown exception." << endl;
}
};
void doWork() {
try {
CORBA::ORB_var orb = globalOrb;
if(orb->work_pending()) {
orb->perform_work();
}
}
catch(CORBA::SystemException&) {
err << "Caught CORBA::SystemException." << endl;
}
catch(CORBA::Exception&) {
err << "Caught CORBA::Exception." << endl;
}
catch(omniORB::fatalException& fe) {
err << "Caught omniORB::fatalException:" << endl;
err << " file: " << fe.file() << endl;
err << " line: " << fe.line() << endl;
err << " mesg: " << fe.errmsg() << endl;
}
catch(...) {
err << "Caught unknown exception." << endl;
}
}
void stopOrb() {
try {
CORBA::ORB_var orb = globalOrb;
err.close();
orb->destroy();
}
catch(CORBA::SystemException&) {
err << "Caught CORBA::SystemException." << endl;
}
catch(CORBA::Exception&) {
err << "Caught CORBA::Exception." << endl;
}
catch(omniORB::fatalException& fe) {
err << "Caught omniORB::fatalException:" << endl;
err << " file: " << fe.file() << endl;
err << " line: " << fe.line() << endl;
err << " mesg: " << fe.errmsg() << endl;
}
catch(...) {
err << "Caught unknown exception." << endl;
}
}
----------------------------------------------------------
The application is calling runOrb, then doWork periodically, and stopOrb
at end. The corba.error file is being steadily filled with
SystemExceptions. I don't know how to dignose what's causing that :)
Help?
Thanks!
--Stephen
More information about the omniORB-list
mailing list