我试图在Ubuntu 12.04上运行C ++中的CORBA示例: http://www.yolinux.com/TUTORIALS/CORBA.html
我尝试运行时仍然出错:
$ ./Server
'IOR:010000001600000049444c3a446174612f53657276696365413a312e3000000001000000000000006800000001010200100000003139322e3136382e3135392e31323900b1aa00000e000000fe4ba4015100001a19000000000000000200000000000000080000000100000000545441010000001c00000001000000010001000100000001000105090101000100000009010100'
Caught CORBA::SystemException.
在启动Server之前我生成了一个日志文件:
omniNames -start 2812 -logdir ~/Desktop -errlog ~/Desktop/omniNamesError.txt
给了我一个文件〜/ Desktop / omniNamesError.txt,如下所示:
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.
接下来我在文件中添加了:
/etc/omniORB.cfg
生成的文件中的行:
InitRef = NameService=IOR:000100010000000100010509010100010000000901010003545\
441080000005ea5015101002002010000002b00000049444c3a6f6d672e6f72672f436f734e61\
6d696e672f4e616d696e67436f6e746578744578743a312e30000001000000000000007400000\
001010200100000003139322e3136382e3135392e31333000fd0a00000b0000004e616d655365\
7276696365000300000000000000080000000100000000545441010000001c000000010000000\
1000100010000000100010509010100010000000901010003545441080000009aad0151010049\
82
我还设置了环境变量:
$ export OMNIORB_CONFIG=/etc/omniORB.cfg
在教程中编写的所有内容,编译的文件(经过2次修改后: 我在CRequestServiceA.cpp添加了 #include 我将 $(CC)$(CPPFLAGS)$(INCLUDES)DataSK.cc 更改为 $(CC)$(CPPFLAGS)$(INCLUDES)DataSK.cc&& mv DataSo.o Data.o 在MakeServer中)但我仍然有一个错误,如我所说。
请帮我解决这个问题,我从许多CORBA C ++教程中学习并且没有任何影响
答案 0 :(得分:1)
配置文件中的那些反斜杠可能导致问题。为避免将冗长的IOR(将更改)粘贴到配置文件中,请尝试在配置文件中设置InitRef
,如下所示(假设您在与测试程序相同的计算机上运行名称服务)。
InitRef = NameService=corbaname::localhost
或者您可以尝试将IOR粘贴为一行(不要破坏该行或添加反斜杠)。
或者您可以像这样运行您的服务器:
$ ./Server -ORBInitRef NameService=corbaname::localhost
或者
$ ./Server -ORBInitRef NameService=IOR:010000002b00000049444c3a6f6d672e6f72672f436f734e616d696e672f4e616d696e67436f6e746578744578743a312e30000001000000000000007400000001010200100000003139322e3136382e3135392e31333000fd0a00000b0000004e616d6553657276696365000300000000000000080000000100000000545441010000001c0000000100000001000100010000000100010509010100010000000901010003545441080000009aad015101004982
如果您确实使用了IOR字符串,请注意每次运行命名服务时几乎肯定会更改,因此请确保使用最新的字符串。
有关详细信息,请参阅omniORB documentation。
看到您的评论后进行修改:
教程可能已过时且已过时。尝试更改此行:
CORBA::Object_var obj1=orb->resolve_initial_references("OmniNameService");
到这个
CORBA::Object_var obj1=orb->resolve_initial_references("NameService");
您可能还希望通过omniORB documentation中的Echo示例。
答案 1 :(得分:-1)
我想我解决了这个问题:我将OmniNameService
更改为NameService
,并添加到我的omniORB.cfg文件中:
InitRef = NameService=IOR:00010....
(IOR名称来自omniNamesError.txt),然后像这样运行服务器:
./Server corbaloc:rir:/NameService