问题
I have a simple calc C++/Java app with CORBA. Server is written in C++, client in Java. I use omniORBs omniNames, as name service.
I would like to run my omniNames and server on my localhost (Ubuntu) and run my client on Windows XP SP3 in VirtualBox installed on my localhost Ubuntu.
(I mean: on my localhost I have installed Ubuntu OS and in Ubuntu I installed VirtuaBox with Windows XP SP3 'inside'.)
I finally did it and set host-only
optinon in VirtualBox with help from this: https://superuser.com/questions/429405/how-can-i-get-virtualbox-to-run-with-a-hosts-only-adapter topic. Now I have some other problem. My client finally see my server and even can connect to it and send him a message but it has problems with receiving an answer from server: (this time my app is a simple calc):
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>
Where 192.168.56.1 is a VirtualBox host-only ip address. Please help:) In the example I posted here, the answer from server should be 8 (because as we all know 2*4 = 8;)
OK friends, sorry for bothering all of you:) I found the answer: I added those lines to my /etc/network/interfaces
file:
allow-hotplug eth0
iface eth0 inet dhcp
Cheerz:D
来源:https://stackoverflow.com/questions/12860512/connectionerror-client-on-virtualbox-and-server-on-localhost-i-use-host