CORBA Frequently Asked Questions (FAQ)
18-749: Fault-Tolerant Distributed Systems
1. How do I get the CORBA HelloWorld program running on a machine?
The following instructions refer to running the CORBA HelloWorld program, with both the client and the server running on a machine called groucho:
2. What is the "orbd"?
orbd is the CORBA nameserver daemon provided with the Java IDL implementation of CORBA. When a server starts up, it registers a string name with the orbd. Clients look up the orbd to find the IOR of the server. Once the client finds the server's IOR, it can talk to the server directly using the object reference embedded within the IOR. For our project, to prevent the orbd being a single point of failure, we will isolate the orbd to a machine which will not be rebooted. In real systems, we would have to replicate the orbd to provide multiple copies of it in case one of the copies fails.
3. How do I get the CORBA HelloWorld program running on different machines across the network?
Pick three machines: groucho, harpo and chico. The following instructions refer to running the CORBA HelloWorld program, with the server on groucho, the orbd on harpo and the client on chico:
4. What do the "-ORBInitialHost" and the "-ORBInitialPort" do, and why do I provide them at the command line for every client and server?
-ORBInitialHost refers to the hostname on which the orbd
is running, or will run
-ORBInitialHost refers to the port number on which the orbd is listening for requests on that host
For more details of the orbd's command-line arguments, look at http://java.sun.com/j2se/1.4.2/docs/guide/idl/orbd.html
5. Which version of the JDK are we using for the project?
We highly recommend that you stick to using JDK 1.4.2 on Linux for your software development, if you're intending to use a Java implementation of CORBA. If you need Linux machines to run your software on, please contact the instructor. It's alright, though, if you run your database on any platform of your choice (e.g., Microsoft SQL server on Windows XP), as long as you have Java/CORBA clients on the Linux machines that can access the database.
6. How can I implement a callback with CORBA?
There are two kinds of callbacks that you could
implement using CORBA:
7. Where do I find information about CORBA exceptions?
Please look at http://java.sun.com/j2se/1.4.2/docs/guide/idl/jidlExceptions.html for more details on the System Exceptions and the User Exceptions that can be thrown by CORBA programs.
8. How do I instantiate a linked list or a list of objects using IDL?
CORBA supports the notion of sequence and array, both of which are IDL keywords. For example,
typedef sequence<HelloServer,1024> HelloServerListBounded
allows you to contain 1024 HelloServer CORBA objects, while
typedef sequence<HelloServer> HelloServerListUnbounded
allows you to contain any number of HelloServer CORBA objects (there's a counter buried inside that allows CORBA to keep track of how many you've inserted or deleted from the list).
Look at http://developer.netscape.com/docs/manuals/enterprise/javaref/idl2jmap.htm for the list of mappings from IDL to Java code (that the compiler automatically performs for you when it creates stubs and skeletons). In particular, check out the "Contructed Types", "Sequence" and "Array". You might want to use either a sequence or an array to represent a list.
Look at http://www.esperanto.org.nz/papers/IntroToCORBAIDL.html for an example of the sequence mapping for some other ORB (VisiBroker). The idea is similar for our ORB, JavaIDL. In this example, note that the IDL interface uses a sequence type called "PriceSequence". If you track that word through the page, you can find out how they initialize and how they use a sequence, both on the client and the server side.
9. When I call a method of a CORBA server, will CORBA pass only the variables whose types are listed explicitly in the IDL file? Can I have an empty IDL interface, run idlj on it, and then add variables to the interface, and have CORBA pass them around?
If you want to pass anything across a CORBA interface, you must define it in IDL. Why? Well, when you declare something to be an IDL type, the IDL-to-Java compiler, idlj, generates stubs and skeletons that tell CORBA how to marshal (package) all variables of that type for transmission across the network. This means that, if you don't put a type into IDL, CORBA does not know how to package it to send it to another process. Such types are treated as local variables, even if they are serializable.
10. It's kind of difficult to make everything work in the directory structure that you gave us because, when we compile the IDL files, the results of the compilation are always placed in the /idl directory instead of the /src directory that we want them to be in. Then, when we compile the files in the /src directory, the results of this compilation are placed in the /src directory rather than in the /classes directory. How do we tell idlj and javac to put their compilation "results" into a different directory?
The following options might help:
idlj -td <path>
javac -sourcepath <path> -d <directory>
To see a list of the command-line options for idlj, just type in "idlj" at the
command-line prompt, and you'll see the entire list.
To see a list of the command-line options for javac, just type in "javac -help" at the command-line prompt, and you'll see the entire list.