如何连接客户端(在VirtualBox上)和服务器(在localhost上)?我使用CORBA和C++/Java

yak*_*yak 4 c++ java connection virtualbox corba

我有一个简单的'Hello world' C++/Java应用程序CORBA.服务器是写入的C++,客户端在Java.我使用omniORBs omniNames作为名称服务.

我想omniNames在我的localhost (Ubuntu)上运行我的服务器,并在我的localhost Ubuntu上安装的VirtualBox中的Windows XP SP3上运行我的客户端.

(我的意思是:在我的localhost上我安装了Ubuntu操作系统,在Ubuntu中我安装了VirtuaBox和Windows XP SP3'.')

我试过这个:

  1. 我在我的Ubuntu localhost上运行omniNames,: omniNames -start
  2. 我在同一台计算机上运行我的服务器,使用Ubuntu OS运行本地主机: ./server -ORBInitRef NameService=corbaloc::localhost:2809/NameService
  3. 我在网站上检查了我的localhosts ip地址:http://whatismyipaddress.com/并将其写下来,例如:xxxx
  4. 在VirtualBox上打开Windows XP,运行客户端: java client -ORBInitRef NameService=corbaloc::x.x.x.x:2809/NameService

但是有错误:

C:\Temp\java>java client -ORBInitRef NameService=corbaloc:212.106.19.209:2809/Na
meService
pa? 10, 2012 3:51:17 PM com.sun.corba.se.impl.naming.namingutil.CorbalocURL badA
ddress
WARNING: "IOP00110603: (BAD_PARAM) Bad host address in -ORBInitDef"
org.omg.CORBA.BAD_PARAM:   vmcid: SUN  minor code: 603  completed: No
        at com.sun.corba.se.impl.logging.NamingSystemException.insBadAddress(Unk
nown Source)
        at com.sun.corba.se.impl.logging.NamingSystemException.insBadAddress(Unk
nown Source)
        at com.sun.corba.se.impl.naming.namingutil.CorbalocURL.badAddress(Unknow
n Source)
        at com.sun.corba.se.impl.naming.namingutil.CorbalocURL.<init>(Unknown So
urce)
        at com.sun.corba.se.impl.naming.namingutil.INSURLHandler.parseURL(Unknow
n Source)
        at com.sun.corba.se.impl.resolver.INSURLOperationImpl.operate(Unknown So
urce)
        at com.sun.corba.se.impl.resolver.ORBInitRefResolverImpl.resolve(Unknown
 Source)
        at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(Unknown
Source)
        at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(Unknown
Source)
        at com.sun.corba.se.impl.orb.ORBImpl.resolve_initial_references(Unknown
Source)
        at client.main(client.java:28)

C:\Temp\java>
Run Code Online (Sandbox Code Playgroud)

是否有可能以这种方式连接客户端和服务器?我该怎么做?我在Windows XP上只有客户端文件 - 仅此而已 - 没有名称服务,没有服务器文件,只是客户端程序.

Ian*_*rts 7

我在网站上检查了我的localhosts ip地址:http://whatismyipaddress.com/并将其写下来,例如:xxxx

这不太可能是正确的IP地址.您是如何为VirtualBox VM配置网络的?如果您使用的是默认NAT网络,则guest虚拟机无法与主机通信,因此您需要配置"仅主机"网络,然后使用此网络主机端的IP地址(您应该能够在告诉客户端在哪里找到ORB时找到ifconfig在Ubuntu主机上使用,查找vboxnet接口.您可能还发现需要在主机上添加防火墙规则以允许虚拟接口上的传入连接.

请注意,您可以为同一个VM配置多个网络接口,因此如果VM需要访问Internet以及ORB,那么可以使用两个接口(一个NAT和另一个主机)进行设置,这是完全可以的.只要.