Discussion:
[omniORB] (no subject)
jochen.heintz at t-online.de ()
2008-03-07 20:38:21 UTC
Permalink
Hi,

i have downloaded the OmniOrb Package "omniORB-4.1.2-x86_win32-vs8.zip"
from Sourceforge.

I'm new to CORBA so i've made a new Project in my Visual studio to test
it.

The Problem is the i get the ErrorMessage

"Windows has triggered a breakpoint in OmniOrbServer.exe.
This may be due to a corruption of the heap, and indicates a
bug in OmniOrbServer.exe or any of the DLLs it has loaded.
The output window may have more diagnostic information"

I have made things from Readme.win32.txt

I set the Debug libs correct and all runs well.

Heres the Source-code :

Server :

// OmniOrbServer.cpp : Defines the entry point for the console
application.
//

#include "stdafx.h"

#include "Test.h"
#include <list>
#include <string>


#define NDEBUG

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


using namespace HalloTest;
using namespace CosNaming;
using namespace CORBA;
using namespace PortableServer;

class HelloServer : public POA_HalloTest::Server
{
public:

inline HelloServer() {}
virtual ~HelloServer() {}
inline virtual char* getWorkflow ();
};

using namespace std;

char* HelloServer::getWorkflow ()
{
String_var hallo = (const char*) "Hallo";
return string_dup(hallo);
}



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

try {

printf("Initialize Orb with Paramenters :\n");
printf("%s\n",argv[1]);
printf("%s\n",argv[2]);
// create and initialize the orb
ORB_var orb = ORB_init(argc, argv);

// get POA reference and activate POA
POA_var poa =
POA::_narrow(orb->resolve_initial_references("RootPOA"));
poa->the_POAManager()->activate();

// create server instance and register it with the ORB
HelloServer *helloServer = new HelloServer();

// get the root naming context
NamingContext_var namingContext =

NamingContext::_narrow(orb->resolve_initial_references("NameService"));

// bind the Object Reference in Naming
printf("Binding Service\n");
Name path;
path.length(1);
path[0].id = (const char*) "Hello"; // string copied
path[0].kind = (const char*) ""; // string copied
namingContext->rebind(path, helloServer->_this());
printf("Starting Server\n");
printf("Server is running\n");
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;
}


Client :


#include "stdafx.h"

#include "Test.h"

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



using namespace HalloTest;
using namespace CosNaming;
using namespace CORBA;


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

printf("Initialize Orb with Paramenters :\n");
printf("%s\n",argv[1]);
printf("%s\n",argv[2]);

// create and initialize the ORB
ORB_var orb = ORB_init(argc, argv);

// get the root naming context
printf("Get Reference to Nameservice\n");
Object_var obj = orb->resolve_initial_references("NameService");
NamingContext_var ncRef = NamingContext::_narrow(obj);

// resolve the Object Reference in Naming
CosNaming::Name path;
path.length(1);
path[0].id = (const char*) "Hello";
path[0].kind = (const char*) "";
printf("Get Reference to Server-Method\n");
Server_var helloRemote = Server::_narrow(ncRef->resolve(path));
printf("Calling server-Method\n");
String_var helloMessage = helloRemote->getWorkflow();
cout << (const char*)helloMessage << endl;

gets(helloMessage);
orb->destroy();
} catch(SystemException& ex) {
cerr << "Caught a 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;
}


The Client calls the Server-Method getWorkflow() and then the Server
crashes and gives the Message "Windows breakpoint..." as described
above.

This happends only in debug. If i run the exe in DOS-Box all works well.

Thanks for any help on this topic ;-)

Greetings Jochen

Loading...