1

I'm trying to run an example of CORBA in C++ on Ubuntu 12.04: http://www.yolinux.com/TUTORIALS/CORBA.html

and I still have an error when I'm trying to run:

    $ ./Server
'IOR:010000001600000049444c3a446174612f53657276696365413a312e3000000001000000000000006800000001010200100000003139322e3136382e3135392e31323900b1aa00000e000000fe4ba4015100001a19000000000000000200000000000000080000000100000000545441010000001c00000001000000010001000100000001000105090101000100000009010100'
Caught CORBA::SystemException.

before starting Server I generated a log file:

omniNames -start 2812 -logdir ~/Desktop -errlog ~/Desktop/omniNamesError.txt

which gave me a file ~/Desktop/omniNamesError.txt as below:

Thu Jan 24 22:54:34 2013:

Starting omniNames for the first time.
Wrote initial log file.
Read log file successfully.
Root context is IOR:010000002b00000049444c3a6f6d672e6f72672f436f734e616d696e672f4e616d696e67436f6e746578744578743a312e30000001000000000000007400000001010200100000003139322e3136382e3135392e31333000fd0a00000b0000004e616d6553657276696365000300000000000000080000000100000000545441010000001c0000000100000001000100010000000100010509010100010000000901010003545441080000009aad015101004982
Checkpointing Phase 1: Prepare.
Checkpointing Phase 2: Commit.
Checkpointing completed.

Next I added at the file:

/etc/omniORB.cfg

line from the generated file:

InitRef = NameService=IOR:000100010000000100010509010100010000000901010003545\
441080000005ea5015101002002010000002b00000049444c3a6f6d672e6f72672f436f734e61\
6d696e672f4e616d696e67436f6e746578744578743a312e30000001000000000000007400000\
001010200100000003139322e3136382e3135392e31333000fd0a00000b0000004e616d655365\
7276696365000300000000000000080000000100000000545441010000001c000000010000000\
1000100010000000100010509010100010000000901010003545441080000009aad0151010049\
82

I also set environment variable:

$ export OMNIORB_CONFIG=/etc/omniORB.cfg

everything as it is written at tutorial, files compiled (after 2 modifications: I added: #include at CRequestServiceA.cpp and I changed $(CC) $(CPPFLAGS) $(INCLUDES) DataSK.cc into $(CC) $(CPPFLAGS) $(INCLUDES) DataSK.cc && mv DataSK.o Data.o in MakeServer) but I still have an error as I told.

Please help me with the problem, I was learning from many CORBA C++ tutorials and no effects

baziorek
  • 2,502
  • 2
  • 29
  • 43

2 Answers2

1

Those backslashes in your config file might be causing the problem. To avoid problems with pasting a lengthy IOR (that will change) into your config file, try setting your InitRef as follows in your config file (assuming your are running the name service on the same machine as your test program).

InitRef = NameService=corbaname::localhost

Or you could try pasting the IOR as one line (don't break the line up or add backslashes).

Or you could run your server like this:

$ ./Server -ORBInitRef NameService=corbaname::localhost

Or

$ ./Server -ORBInitRef NameService=IOR:010000002b00000049444c3a6f6d672e6f72672f436f734e616d696e672f4e616d696e67436f6e746578744578743a312e30000001000000000000007400000001010200100000003139322e3136382e3135392e31333000fd0a00000b0000004e616d6553657276696365000300000000000000080000000100000000545441010000001c0000000100000001000100010000000100010509010100010000000901010003545441080000009aad015101004982

If you do use the IOR string, please realize it will almost certainly change every time you run the naming service, so make sure you are using the most current one.

Please see the omniORB documentation for more information.

Edit after seeing your comment:

The tutorial might be old and out of date. Try changing this line:

CORBA::Object_var obj1=orb->resolve_initial_references("OmniNameService");

to this

CORBA::Object_var obj1=orb->resolve_initial_references("NameService");

You may also wish to work through the Echo example in the omniORB documentation.

Brian Neal
  • 31,821
  • 7
  • 55
  • 59
  • Thanks much for your answer, I tried all alternatives you told, but unfortunately I still have an error. I can add that the exception is thrown in line: _ CosNaming::NamingContext_var nc = CosNaming::NamingContext::_narrow(obj1.in()); _ – baziorek Jan 25 '13 at 22:10
  • Thanks much for your answer! I changed as you told: _CORBA::Object_var obj1=orb->resolve_initial_references("OmniNameService");_ to: _CORBA::Object_var obj1=orb->resolve_initial_references("NameService");_ in both **Server.cpp** and **CRequestServiceA.cpp** files and it works now. Thanks for your help! – baziorek Jan 26 '13 at 11:54
  • Great! Again, I don't know how old that tutorial is you are looking at, but it might be better to work through the Echo examples in the omniORB documentation. Good luck. – Brian Neal Jan 26 '13 at 16:13
-1

I think I solve this: I changed OmniNameService to NameService, and added in my omniORB.cfg file:

InitRef = NameService=IOR:00010....

(the IOR name came from omniNamesError.txt), then run the server like this:

./Server corbaloc:rir:/NameService
Toby Speight
  • 27,591
  • 48
  • 66
  • 103