|
|
Java IDL Frequently Asked QuestionsThis is the first version of a Java IDL FAQ, and is very incomplete. Suggestions, comments and corrections greatly appreciated. Encouraging words especially appreciated, as this is often all that I need to motivate me to keep going. Send mail to sbarber@alum.mit.edu. What is Java IDL?Java IDL is a reference implementation of a CORBA Object Request Broker for Java, including support for the IDL to Java Mapping Specification as well as a transient implementation of the CosNaming service. Java IDL is included as a core package in Sun Microsystems' Java 2 releases (often referred to as JDK 1.2). Is Java IDL useful for real work?Yes, especially for Java CORBA clients that use a CORBA Naming Service to discover server references. It's also fine for Java CORBA servers that run as persistent servers; that is, those that are started manually and don't need to be activated by an ORB or ORB-related service. While this isn't the way all CORBA deployments are configured, this method is used more often than one would think just from reading OMG specifications. If the system is using the Java IDL-provided tnameserv CORBA Naming Service, then the servers must be written to re-register themselves each time they are started. tnameserv isn't particularly fault-tolerant, so this may be the first piece to consider replacing to do "real work" with Java IDL. With what CORBA standards does Java IDL comply?According to the JDK 1.2 documentation, the Java IDL in JDK 1.2 is compliant with the CORBA/IIOP 2.0 Specification (orbos/97-02-25) and the IDL-to-Java Language Mapping (orbos/98-01-06 Final). Where's the IDL to Java compiler for Java IDL?It's called idltojava, and it doesn't come with the JDK. It can be obtained for free for Windows and Solaris SPARC platforms by those willing to register as members of Sun's Java Developer Connection, at http://developer.javasoft.com Can I get idltojava for platforms other than Windows and SPARC Solaris?I don't think so. Can I use other IDL to Java compilers to generate Java IDL stubs and skeletons?In theory, yes. But in practice, some little problem usually creeps up that prevents it from working. Try looking for "strict" or "OMG" options on your compiler, but I haven't had much luck with this kind of thing. Counter-examples welcomed! Why does idltojava give a can't find the preprocessor error on Windows?This is because the idltojava compiler needs a C/C++ preprocessor in order to process the IDL directives that begin with #. Can I use idltojava without a preprocessor?If your idl file doesn't have any #-directives, the -fno-cpp option can be specified so that idltojava won't try to run a pre-processor. How do I get the pre-processor working with idltojava?The pre-processor has to be findable by idltojava, and the right options must somehow be passed to it. Sun actually documents what's going on here, and you can read about it in the idltojava documentation that came with the idltojava compiler for your platform. Or, see the FAQ below about using other pre-processors. Most of the details are re-stated there. How can I use the Micrsoft Visual C++ preprocessor with idltojava?For Visual C++ 5.0, there a file called vcvars32.bat that lives in x:\Program Files\DevStudio\VC\bin, where x is the drive where Visual C++ is installed. It may have to be edited to get all the drive letters right. Just execute vcvars32.bat in the command shell where idltojava will be run. For those interested in such things, for an IDL file called x.idl, idltojava for Java 1.2 preprocesses via Visual C++ by issuing the following command: cl /nologo /C /E /X /Tp x.idl How can I use the lcc preprocessor with idltojava?There's a simple preprocessor available as part of the lcc compiler. It's free unless included as part of a commercial product. The full lcc distribution and lots of other information on lcc is available at http://www.cs.princeton.edu/software/lcc Here are the settings that worked for me on Windows 98: set CPP=c:\pathto\cpp set CPPARGS=-N How can I use other preprocessors with idltojava?Here's the note from the Sun idltojava documentation on how this is supposed to work:
> set CPP=\usr\share\lib\cpp > set CPPARGS=\nologo NT --go to Control Panel-->System and click on the Environment tab; then set the environment variables Examples for Solaris users: C shell --in your .cshrc file, type something like > setenv CPP /usr/ccs/lib/cpp > setenv CPPARGS -BCY Bourne or Korn shells --in your .profile file, type something like > CPP=/usr/ccs/lib/cpp > export CPP > CPPARGS=-BCY > export CPPARGS In the example above, B tells the preprocessor to support C++ style comments (// to indicate that the rest of the line is a comment), C tells the preprocessor to leave comments in the preprocessed file, and Y tells the preprocessor not to bother looking at standard input files (such as /usr/include) since they are mostly C header files. When you run idltojava with these two environment variables set, and the flag -fcpp is ON, idltojava will automatically use the preprocessor you specified in CPP and pass it the arguments you put in CPPARGS. What minor codes are used when Java IDL returns CORBA exceptions, and what do they mean?CORBA defines two kinds of exception codes, major codes and minor codes. Major codes
correspond directly to CORBA-defined exception types, and are defined by the OMG in the
CORBA specification. Under Construction -- Partial List Only
Copyright 1999 Steven E. Barber. All Rights Reserved. |