ConnectionError [客户端(VirtualBox上)和服务器(在localhost)]

2019-09-24 01:34发布

我有CORBA一个简单的计算C ++ / Java应用程序。 服务器用C ++编写,客户端在Java中。 我用omniORBs omniNames,如名称服务。

我想在我的本地(Ubuntu的)运行我omniNames和服务器上的Windows XP SP3安装在我的本地Ubuntu的运行我的客户在VirtualBox中。

(我的意思是:在我的本地我已经安装了Ubuntu操作系统,在Ubuntu我与Windows XP SP3“内部”安装VirtuaBox。)

我终于做到了,并设置host-only optinon在VirtualBox中与此帮助: https://superuser.com/questions/429405/how-can-i-get-virtualbox-to-run-with-a-hosts-only -adapter话题。 现在我有一些其他的问题。 我的客户终于看到我的服务器,甚至可以连接到它,并给他发个消息,但它有问题,从服务器接收答案:(这段时间我的应用程序是一个简单的计算):

C:\Temp\java>java client -ORBInitRef NameService=corbaloc::192.168.56.1:2809/NameService  Choose:
1.Add
2.Sub
3.Mul
4.Div
> 3 
> Pass number:
> 2
> Pass number:
> 4 
> pač 12, 2012 3:36:58 PM  com.sun.corba.se.impl.transport.SocketOrChannelConnectio nImpl <init> WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType:  IIOP_CLEAR
_TEXT; hostname: 127.0.0.1; port: 41431" org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
        at  com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(U nknown Source)
        at  com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(U nknown Source)
        at  com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>( Unknown Source)
        at  com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>( Unknown Source)
        at  com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl.create Connection(Unknown Source)
        at  com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.begin Request(Unknown Source)
        at  com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.request(Unknow n Source)
        at org.omg.CORBA.portable.ObjectImpl._request(Unknown Source)
        at _CalcStub.mul(_CalcStub.java:64)
        at client.main(client.java:65) Caused by: java.net.ConnectException: Connection refused: connect
        at sun.nio.ch.Net.connect0(Native Method)
        at sun.nio.ch.Net.connect(Unknown Source)
        at sun.nio.ch.Net.connect(Unknown Source)
        at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
        at java.nio.channels.SocketChannel.open(Unknown Source)
        at  com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl.createSocket (Unknown Source)
        ... 8 more



C:\Temp\java>

其中192.168.56.1是VirtualBox的唯一主机的IP地址。 请帮助:)在我这里张贴的例子中,从服务器的答案应该是8(因为大家都知道2 * 4 = 8;)

OK啦,对不起,打扰你们:)我找到了答案:我添加这些行到我/etc/network/interfaces文件:

allow-hotplug eth0 
iface eth0 inet dhcp

Cheerz:d

文章来源: ConnectionError [client (on VirtualBox) and server (on localhost)] - I use host-only setting on VM