Wittstruck, Nicholas
2010-06-30 15:27:51 UTC
Hi,
i am trying to connect a c++ program to a java server, using corba.
The server finds my client, and is able to call the first operation (initializePlugin(...)). This method sets a guiManager, which is used to call some functions on the server.
This works only in the first call to the c++ program. Whenever I try to access the guiManager afterwards in a second method (pi(...)), I get the following error:
----
omniORB: omniRemoteIdentity deleted.
omniORB: ObjRef(IDL:calculator/GuiManager:1.0) -- deleted.
omniORB: Return from remote call 'initializePlugin' to: root<0> (active)
omniORB: inputMessage: from giop:tcp:[::ffff:192.168.0.102]:55666 111 bytes
omniORB:
4749 4f50 0102 0000 0000 0063 0000 0006 GIOP.......c....
0300 0000 0000 0002 0000 000e fe23 722a .............#r*
4c00 0007 2c00 0000 0000 0001 0000 0003 L...,...........
7069 0074 0000 0003 0000 0011 0000 0002 pi.t............
0002 000c 0000 0001 0000 000c 0000 0000 ................
0001 0001 0001 0109 4e45 4f00 0000 0002 ........NEO.....
0014 0001 0001 0109 0000 0003 7069 00 ............pi.
omniORB: Receive codeset service context and set TCS to (ISO-8859-1,UTF-16)
omniORB: Dispatching remote call 'pi' to: root<0> (active)
manager ist not null
006E1CC8
omniORB: ERROR -- the application attempted to invoke an operation
on a nil reference.
omniORB: throw INV_OBJREF from exception.cc:487 (NO,INV_OBJREF_InvokeOnNilObjRef
)
omniORB: Scan for idle connections (1277850162,124000000)
----
I am kinda confused, because I am testing wether the manager is null or not, using CORBA::is_nil(). This method says, that the manager is not null, but the program keeps crashing when it accesses the manager to call the setText method.
The code of my c++ class is:
----
class calculator_Functions_i: public POA_calculator::Functions
{
private:
calculator::GuiManager_ptr pManager;
public:
calculator_Functions_i();
virtual ~calculator_Functions_i();
void manager(calculator::GuiManager_ptr);
calculator::GuiManager_ptr manager();
void pi(const char* id);
void initializePlugin(calculator::GuiManager_ptr manager);
};
...
void calculator_Functions_i::manager(calculator::GuiManager_ptr ptr)
{
pManager = ptr;
}
calculator::GuiManager_ptr calculator_Functions_i::manager()
{
return pManager;
}
void calculator_Functions_i::pi(const char* id)
{
if (CORBA::is_nil(calculator_Functions_i::manager()))
{
cerr << "manager is null" << endl;
}
else
{
cerr << "manager is not null" << endl;
char* displayId = "display";
char* text = "text";
calculator::GuiManager_ptr manager = calculator_Functions_i::manager();
cerr << manager << endl;
calculator_Functions_i::manager()->setText(displayId, text);
}
}
void calculator_Functions_i::initializePlugin(calculator::GuiManager_ptr manager)
{
calculator_Functions_i::manager(manager);
// load gui.xml:
ifstream xmlFile;
xmlFile.open ("gui.xml");
if (xmlFile.is_open())
{
xmlFile.seekg(0, ios::end);
unsigned long fileSize = streamoff(xmlFile.tellg())+1;
xmlFile.seekg(0, ios::beg);
char* pBuffer = new char[fileSize];
xmlFile.read(pBuffer, fileSize-1);
// terminate the string:
pBuffer[xmlFile.gcount()] = '\0';
xmlFile.close();
calculator_Functions_i::manager()->initializeUserInterface(pBuffer);
char* displayId = "display";
char* text = "text";
calculator_Functions_i::manager()->setText(displayId, text);
}
}
----
The server cann call initializePlugin(..), and everything works fine. Whenever the server tries to call pi(...) the error listed above comes up. Does anyone have an idea, what the problem might be? I'm using the newest omniORB version.
Thanks in advance,
Nicholas.
i am trying to connect a c++ program to a java server, using corba.
The server finds my client, and is able to call the first operation (initializePlugin(...)). This method sets a guiManager, which is used to call some functions on the server.
This works only in the first call to the c++ program. Whenever I try to access the guiManager afterwards in a second method (pi(...)), I get the following error:
----
omniORB: omniRemoteIdentity deleted.
omniORB: ObjRef(IDL:calculator/GuiManager:1.0) -- deleted.
omniORB: Return from remote call 'initializePlugin' to: root<0> (active)
omniORB: inputMessage: from giop:tcp:[::ffff:192.168.0.102]:55666 111 bytes
omniORB:
4749 4f50 0102 0000 0000 0063 0000 0006 GIOP.......c....
0300 0000 0000 0002 0000 000e fe23 722a .............#r*
4c00 0007 2c00 0000 0000 0001 0000 0003 L...,...........
7069 0074 0000 0003 0000 0011 0000 0002 pi.t............
0002 000c 0000 0001 0000 000c 0000 0000 ................
0001 0001 0001 0109 4e45 4f00 0000 0002 ........NEO.....
0014 0001 0001 0109 0000 0003 7069 00 ............pi.
omniORB: Receive codeset service context and set TCS to (ISO-8859-1,UTF-16)
omniORB: Dispatching remote call 'pi' to: root<0> (active)
manager ist not null
006E1CC8
omniORB: ERROR -- the application attempted to invoke an operation
on a nil reference.
omniORB: throw INV_OBJREF from exception.cc:487 (NO,INV_OBJREF_InvokeOnNilObjRef
)
omniORB: Scan for idle connections (1277850162,124000000)
----
I am kinda confused, because I am testing wether the manager is null or not, using CORBA::is_nil(). This method says, that the manager is not null, but the program keeps crashing when it accesses the manager to call the setText method.
The code of my c++ class is:
----
class calculator_Functions_i: public POA_calculator::Functions
{
private:
calculator::GuiManager_ptr pManager;
public:
calculator_Functions_i();
virtual ~calculator_Functions_i();
void manager(calculator::GuiManager_ptr);
calculator::GuiManager_ptr manager();
void pi(const char* id);
void initializePlugin(calculator::GuiManager_ptr manager);
};
...
void calculator_Functions_i::manager(calculator::GuiManager_ptr ptr)
{
pManager = ptr;
}
calculator::GuiManager_ptr calculator_Functions_i::manager()
{
return pManager;
}
void calculator_Functions_i::pi(const char* id)
{
if (CORBA::is_nil(calculator_Functions_i::manager()))
{
cerr << "manager is null" << endl;
}
else
{
cerr << "manager is not null" << endl;
char* displayId = "display";
char* text = "text";
calculator::GuiManager_ptr manager = calculator_Functions_i::manager();
cerr << manager << endl;
calculator_Functions_i::manager()->setText(displayId, text);
}
}
void calculator_Functions_i::initializePlugin(calculator::GuiManager_ptr manager)
{
calculator_Functions_i::manager(manager);
// load gui.xml:
ifstream xmlFile;
xmlFile.open ("gui.xml");
if (xmlFile.is_open())
{
xmlFile.seekg(0, ios::end);
unsigned long fileSize = streamoff(xmlFile.tellg())+1;
xmlFile.seekg(0, ios::beg);
char* pBuffer = new char[fileSize];
xmlFile.read(pBuffer, fileSize-1);
// terminate the string:
pBuffer[xmlFile.gcount()] = '\0';
xmlFile.close();
calculator_Functions_i::manager()->initializeUserInterface(pBuffer);
char* displayId = "display";
char* text = "text";
calculator_Functions_i::manager()->setText(displayId, text);
}
}
----
The server cann call initializePlugin(..), and everything works fine. Whenever the server tries to call pi(...) the error listed above comes up. Does anyone have an idea, what the problem might be? I'm using the newest omniORB version.
Thanks in advance,
Nicholas.