C++ omniORB C++;服务器、Java客户端运行应用程序时出现问题

C++ omniORB C++;服务器、Java客户端运行应用程序时出现问题,c++,java,corba,omniorb,C++,Java,Corba,Omniorb,我在运行应用程序时遇到问题。我有一个服务器: #include "Hello_impl.h" #include <iostream> #include <omniORB4/CORBA.h> #include <omniORB4/Naming.hh> using namespace std; int main(int argc, char ** argv) { try { // init ORB CORBA::ORB_ptr orb = CORBA::ORB

我在运行应用程序时遇到问题。我有一个服务器:

#include "Hello_impl.h"
#include <iostream>
#include <omniORB4/CORBA.h>
#include <omniORB4/Naming.hh>

using namespace std;

int main(int argc, char ** argv)
{
try {
// init ORB
CORBA::ORB_ptr orb = CORBA::ORB_init(argc, argv);

// init POA
CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(poa_obj);
PortableServer::POAManager_var manager = poa->the_POAManager();

// create service
Hello_impl * service = new Hello_impl;

// register within the naming service
try {
CORBA::Object_var ns_obj = orb->resolve_initial_references("NameService");
if (!CORBA::is_nil(ns_obj)) {
CosNaming::NamingContext_ptr nc = CosNaming::NamingContext::_narrow(ns_obj);
CosNaming::Name name;
name.length(1);
name[0].id = CORBA::string_dup("TestServer");
name[0].kind = CORBA::string_dup("");
nc->rebind(name, service->_this());
cout << "Server is running ..." << endl;
}
} catch (CosNaming::NamingContext::NotFound &) {
cerr << "not found" << endl;
} catch (CosNaming::NamingContext::InvalidName &) {
cerr << "invalid name" << endl;
} catch (CosNaming::NamingContext::CannotProceed &) {
cerr << "cannot proceed" << endl;
}

// run
manager->activate();
orb->run();

// clean up
delete service;

// quit
orb->destroy();
} catch (CORBA::UNKNOWN) {
cerr << "unknown exception" << endl;
} catch (CORBA::SystemException &) {
cerr << "system exception" << endl;
}
}
我开始用这样的名字:

omniNames -start 6666 -logdir /home/mazix/Desktop/example/logs -errlog /home/mazix/Desktop/example/logs/omniNamesError.txt
./server -ORBInitRef NameService=IOR: .... (and here is my IOR num)
java client -ORBInitRef NameService=corbaloc::localhost:6666/NameService
./server NameService=corbaname::localhost:6666
然后,我启动服务器,如下所示:

omniNames -start 6666 -logdir /home/mazix/Desktop/example/logs -errlog /home/mazix/Desktop/example/logs/omniNamesError.txt
./server -ORBInitRef NameService=IOR: .... (and here is my IOR num)
java client -ORBInitRef NameService=corbaloc::localhost:6666/NameService
./server NameService=corbaname::localhost:6666
我启动客户端(在同一台计算机上):如下所示:

omniNames -start 6666 -logdir /home/mazix/Desktop/example/logs -errlog /home/mazix/Desktop/example/logs/omniNamesError.txt
./server -ORBInitRef NameService=IOR: .... (and here is my IOR num)
java client -ORBInitRef NameService=corbaloc::localhost:6666/NameService
./server NameService=corbaname::localhost:6666
它正在工作,但我想(需要)像这样启动我的服务器:

omniNames -start 6666 -logdir /home/mazix/Desktop/example/logs -errlog /home/mazix/Desktop/example/logs/omniNamesError.txt
./server -ORBInitRef NameService=IOR: .... (and here is my IOR num)
java client -ORBInitRef NameService=corbaloc::localhost:6666/NameService
./server NameService=corbaname::localhost:6666
和克林特:

java client -ORBInitialHost localhost -ORBInitialPort 6666 
但当我这样开始时,它就不起作用了:/

有什么帮助吗(

这是我的omniORB配置文件:

除此之外,当服务器在我的计算机上,而客户端在我学校的计算机上时,我遇到了问题。他们彼此“看不见”:(


好的,我知道:我没有启动omniNames,但在启动omniNames之前,有人在2809端口监听,我检查了它,它:

我认为这没问题,我不需要通过输入终端“omniNames”来运行omniNames,但我没有这样做

我只是试着像你说的那样运行我的服务器:


我试过这个:

  • 运行我的omniNames:omniNames-开始6666
  • 运行我的服务器:./server-ORBInitRef-NameService=corbaloc::localhost:6666/NameService-ORBtraceLevel 40
  • 得到这个:

    mazix@computer:~/Desktop/example/cpp$ ./server -ORBInitRef NameService=corbaloc::localhost:6666/NameServie -ORBtraceLevel 40
    omniORB: Read from configuration file "/etc/omniORB.cfg".
    omniORB: Version: 4.1.2
    omniORB: Distribution date: Thu Feb 14 14:19:08 GMT 2008 dgrisby
    omniORB: My addresses are: 
    omniORB: 127.0.0.1
    omniORB: 10.0.2.15
    omniORB: ::1
    omniORB: Maximum supported GIOP version is 1.2
    omniORB: Native char code sets: ISO-8859-1 UTF-8.
    omniORB: Transmission char code sets: ISO-8859-1(1.2) ISO-8859-1(1.1) ISO-8859-1(1.0) UTF-8(1.2) UTF-8(1.1).
    omniORB: Native wide char code sets: UTF-16.
    omniORB: Transmission wide char code sets: UTF-16(1.2).
    omniORB: Information: the omniDynamic library is not linked.
    omniORB: Creating ref to remote: key<INIT>
     target id      : omg.org/CORBA/InitialReferences:1.0
     most derived id: omg.org/CORBA/InitialReferences:1.0
    omniORB: Current configuration is as follows:
    omniORB:   DefaultInitRef (file) = corbaloc::localhost:6666/NameService
    omniORB:   DefaultInitRef (args) = 
    omniORB:   InitRef = NameService=corbaloc::localhost:6666/NameServie
    omniORB:   abortOnInternalError = 0
    omniORB:   abortOnNativeException = 0
    omniORB:   acceptBiDirectionalGIOP = 0
    omniORB:   acceptMisalignedTcIndirections = 0
    omniORB:   bootstrapAgentHostname = localhost
    omniORB:   bootstrapAgentPort = 900
    omniORB:   clientCallTimeOutPeriod = 0
    omniORB:   clientConnectTimeOutPeriod = 0
    omniORB:   clientTransportRule = * unix,ssl,tcp
    omniORB:   configFile = /etc/omniORB.cfg
    omniORB:   connectionWatchImmediate = 0
    omniORB:   connectionWatchPeriod = 50000
    omniORB:   copyValuesInLocalCalls = 1
    omniORB:   diiThrowsSysExceptions = 0
    omniORB:   dumpConfiguration = 0
    omniORB:   endPoint = giop:tcp::
    omniORB:   endPointPublish = addr
    omniORB:   giopMaxMsgSize = 2097152
    omniORB:   giopTargetAddressMode = KeyAddr
    omniORB:   id = omniORB4
    omniORB:   idleThreadTimeout = 10
    omniORB:   immediateAddressSwitch = 0
    omniORB:   inConScanPeriod = 180
    omniORB:   lcdMode = 0
    omniORB:   maxGIOPConnectionPerServer = 5
    omniORB:   maxGIOPVersion = 1.2
    omniORB:   maxInterleavedCallsPerConnection = 5
    omniORB:   maxServerThreadPerConnection = 100
    omniORB:   maxServerThreadPoolSize = 100
    omniORB:   maxSocketRecv = 2147483647
    omniORB:   maxSocketSend = 2147483647
    omniORB:   nativeCharCodeSet = ISO-8859-1
    omniORB:   nativeWCharCodeSet = UTF-16
    omniORB:   objectTableSize = 0
    omniORB:   offerBiDirectionalGIOP = 0
    omniORB:   oneCallPerConnection = 1
    omniORB:   outConScanPeriod = 120
    omniORB:   poaHoldRequestTimeout = 0
    omniORB:   poaUniquePersistentSystemIds = 1
    omniORB:   principal = [Null]
    omniORB:   resetTimeOutOnRetries = 0
    omniORB:   scanGranularity = 5
    omniORB:   serverCallTimeOutPeriod = 0
    omniORB:   serverTransportRule = * unix,ssl,tcp
    omniORB:   socketSendBuffer = -1
    omniORB:   strictIIOP = 1
    omniORB:   supportBootstrapAgent = 1
    omniORB:   supportCurrent = 1
    omniORB:   supportPerThreadTimeOut = 0
    omniORB:   tcAliasExpand = 0
    omniORB:   threadPerConnectionLowerLimit = 9000
    omniORB:   threadPerConnectionPolicy = 1
    omniORB:   threadPerConnectionUpperLimit = 10000
    omniORB:   threadPoolWatchConnection = 1
    omniORB:   traceExceptions = 1
    omniORB:   traceFile = [stderr]
    omniORB:   traceInvocationReturns = 0
    omniORB:   traceInvocations = 0
    omniORB:   traceLevel = 40
    omniORB:   traceThreadId = 0
    omniORB:   traceTime = 0
    omniORB:   unixTransportDirectory = /tmp/omni-%u
    omniORB:   unixTransportPermission =  777
    omniORB:   useTypeCodeIndirections = 1
    omniORB:   verifyObjectExistsAndType = 1
    omniORB: Initialising incoming endpoints.
    omniORB: Instantiate endpoint 'giop:tcp::0'
    omniORB: Bind to address 0.0.0.0
    omniORB: Publish specification: 'addr'
    omniORB: Try to publish 'addr' for endpoint giop:tcp:10.0.2.15:44025
    omniORB: Publish endpoint 'giop:tcp:10.0.2.15:44025'
    omniORB: Starting serving incoming endpoints.
    omniORB: Creating ref to remote: key<NameServie>
     target id      : IDL:omg.org/CORBA/Object:1.0
     most derived id: 
    omniORB: Initial reference `NameService' resolved from -ORBInitRef argument / ORB registration.
    omniORB: Client attempt to connect to giop:tcp:localhost:6666
    omniORB: Switch rope to use address giop:tcp:localhost:6666
    omniORB: Unable to open new connection: giop:tcp:localhost:6666
    omniORB: throw giopStream::CommFailure from giopStream.cc:1148(0,NO,TRANSIENT_ConnectFailed)
    omniORB: throw TRANSIENT from omniObjRef.cc:789 (NO,TRANSIENT_ConnectFailed)
    system exceptionTRANSIENT_ConnectFailed
    omniORB: omniRemoteIdentity deleted.
    omniORB: ObjRef() -- deleted.
    omniORB: ORB not destroyed; no final clean-up.
    
    mazix@computer:~/Desktop/example/cpp$。/server-ORBInitRef-NameService=corbaloc::localhost:6666/NameServie-ORBtraceLevel 40
    omniORB:从配置文件“/etc/omniORB.cfg”读取。
    omniORB:版本:4.1.2
    omniORB:发布日期:星期四2月14日14:19:08格林威治标准时间2008德格里斯比
    omniORB:我的地址是:
    omniORB:127.0.0.1
    omniORB:10.0.2.15
    omniORB:::1
    omniORB:支持的最大GIOP版本为1.2
    omniORB:本机字符代码集:ISO-8859-1 UTF-8。
    omniORB:传输字符代码集:ISO-8859-1(1.2)ISO-8859-1(1.1)ISO-8859-1(1.0)UTF-8(1.2)UTF-8(1.1)。
    omniORB:本机宽字符代码集:UTF-16。
    omniORB:传输范围宽的字符代码集:UTF-16(1.2)。
    omniORB:信息:omniDynamic库未链接。
    omniORB:创建对远程:键的引用
    目标id:omg.org/CORBA/InitialReferences:1.0
    most派生id:omg.org/CORBA/InitialReferences:1.0
    omniORB:当前配置如下:
    omniORB:DefaultInitRef(文件)=corbaloc::localhost:6666/NameService
    omniORB:DefaultInitRef(args)=
    omniORB:InitRef=NameService=corbaloc::localhost:6666/NameService
    omniORB:abortOnInternalError=0
    omniORB:AbortOnativeException=0
    omniORB:AcceptBidDirectionAlgiop=0
    omniORB:AcceptDisalignedsDirections=0
    omniORB:bootstrapagenthHostName=localhost
    omniORB:bootstrapAgentPort=900
    omniORB:clientCallTimeOutPeriod=0
    omniORB:clientConnectTimeOutPeriod=0
    omniORB:clientTransportRule=*unix、ssl、tcp
    omniORB:configFile=/etc/omniORB.cfg
    omniORB:connectionWatchImmediate=0
    omniORB:connectionWatchPeriod=50000
    omniORB:copyValuesInLocalCalls=1
    omniORB:diiThrowsSysExceptions=0
    omniORB:dumpConfiguration=0
    omniORB:endPoint=giop:tcp::
    omniORB:endPointPublish=addr
    omniORB:giopMaxMsgSize=2097152
    omniORB:giopTargetAddressMode=KeyAddr
    omniORB:id=omniORB4
    omniORB:idleThreadTimeout=10
    omniORB:ImmediatedDressSwitch=0
    omniORB:inConScanPeriod=180
    omniORB:lcdMode=0
    omniORB:maxGIOPConnectionPerServer=5
    omniORB:maxGIOPVersion=1.2
    omniORB:maxInterleavedCallsPerConnection=5
    omniORB:maxServerThreadPerConnection=100
    omniORB:maxServerThreadPoolSize=100
    omniORB:maxSocketRecv=2147483647
    omniORB:maxSocketSend=2147483647
    omniORB:nativeCharCodeSet=ISO-8859-1
    omniORB:nativeWCharCodeSet=UTF-16
    omniORB:objectTableSize=0
    omniORB:offerBiDirectionalGIOP=0
    omniORB:oneCallPerConnection=1
    omniORB:outConScanPeriod=120
    omniORB:poaHoldRequestTimeout=0
    omniORB:poaUniquePersistentSystemIds=1
    omniORB:principal=[Null]
    omniORB:resetTimeOutOnRetries=0
    omniORB:scanGranularity=5
    omniORB:serverCallTimeOutPeriod=0
    omniORB:serverTransportRule=*unix、ssl、tcp
    omniORB:socketSendBuffer=-1
    omniORB:strictIIOP=1
    omniORB:supportBootstrapAgent=1
    omniORB:supportCurrent=1
    omniORB:supportPerThreadTimeOut=0
    omniORB:tcAliasExpand=0
    omniORB:threadPerConnectionLowerLimit=9000
    omniORB:threadPerConnectionPolicy=1
    omniORB:threadPerConnectionUpperLimit=10000
    omniORB:threadPoolWatchConnection=1
    omniORB:traceExceptions=1
    omniORB:traceFile=[stderr]
    omniORB:traceInvocationReturns=0
    omniORB:traceInvocations=0
    omniORB:traceLevel=40
    omniORB:traceThreadId=0
    omniORB:traceTime=0
    omniORB:unixTransportDirectory=/tmp/omni-%u
    omniORB:unixTransportPermission=777
    omniORB:UseTypeCodeIndirection=1
    omniORB:verifyObjectExistsAndType=1
    omniORB:初始化传入端点。
    omniORB:实例化端点“giop:tcp::0”
    omniORB:绑定到地址0.0.0.0
    omniORB:发布规范:“addr”
    omniORB:尝试为端点giop:tcp:10.0.2.15:44025发布“addr”
    omniORB:发布端点'giop:tcp:10.0.2.15:44025'
    omniORB:开始为传入端点提供服务。
    omniORB:创建对远程:键的引用
    目标id:IDL:omg.org/CORBA/Object:1.0
    大多数派生id:
    omniORB:初始引用'NameService'由-ORBInitRef参数/ORB注册解析。
    omniORB:客户端尝试连接到giop:tcp:localhost:6666
    omniORB:使用地址giop:tcp:localhost:6666的交换机rope
    omniORB:无法打开新连接:giop:tcp:localhost:6666
    omniORB:throw giopStream::来自giopStream的CommFailure.cc:1148(0,否,暂时连接失败)
    omniORB:从omniObjRef.cc:789抛出瞬态(否,瞬态连接失败)
    系统异常Transient\u连接失败
    omniORB:omniRemoteIdentity已删除。
    omniORB:ObjRef()--已删除。
    omniORB:球体未被摧毁;没有最终清理。
    
  • 什么是localHist?你是说localHost吗

  • 我记得,CORBA客户端总是需要提供IOR或corbaloc字符串。也许您可以在本地配置,但这可能是特定于客户端的。哟