Search code examples
javac++connectionvirtualboxcorba

How to connect client (on VirtualBox) and server (on localhost)? I use CORBA and C++/Java


I have a simple 'Hello world' 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 tried this:

  1. I ran omniNames on my Ubuntu localhost, : omniNames -start
  2. I ran my server, also on the same computer, localhost with Ubuntu OS: ./server -ORBInitRef NameService=corbaloc::localhost:2809/NameService
  3. I checked my localhosts ip address on site: http://whatismyipaddress.com/ and wrote it down, which was, for example: x.x.x.x
  4. Turned on Windows XP on VirtualBox, ran client: java client -ORBInitRef NameService=corbaloc::x.x.x.x:2809/NameService

but got errors:

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>

Is it possible to connect client and server that way? How should I do this? I have only clients files on Windows XP - nothing more - no nameservice, no server files, just clients program.


Solution

  • I checked my localhosts ip address on site: http://whatismyipaddress.com/ and wrote it down, which was, for example: x.x.x.x

    This is very unlikely to be the right IP address to use. How have you configured networking for your VirtualBox VM? If you're using the default NAT networking then the guest can't talk to the host, so instead you need to configure a "host-only" network, and then use the IP address of the host side of this network (which you should be able to find using ifconfig on the Ubuntu host, look for the vboxnet interface) when telling the client where to find the ORB. You may also find you need to add firewall rules on the host machine to permit incoming connections on the virtual interface.

    Note that you can have more than one network interface configured for the same VM, so if the VM needs access to the internet as well as to the ORB then it's perfectly OK to set it up with two interfaces, one NAT and the other host-only.