X
736

Tips for Debugging Java-IDL Export Bridge Interface Problems

Topic
This Help Article is designed to list a set of debugging tools and procedures available to Java-IDL Export Bridge programmers, who may sometimes see their developing programs return error messages regarding the interface. Below are some error messages, whose workarounds may be discovered by following one or more of the steps below:

    Failed to load javaidlb from from default location.
    Exception in thread "main" java.lang.UnsatisfiedLinkError: nativeInitJPAL

    *** java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: \idl_bml.dll
    Failed to load idl_bml from default location

    Exception in thread "main" com.rsi.javaidl.JIDLException: 
    Attempt to call undefined procedure/function: 'MYCUSTOMJAVAIDLCONNECTORCLASS__DEFINE'.

Discussion
The following instructions describes options to debug Java-IDL Export Bridge issues:

1. If you are on a UNIX-based operating system, make sure that you run:
C shell syntax:

    source [IDL_DIR]/bin/idl_setup
    source [IDL_DIR]/bin/bridge_setup

... or Bash shell syntax:

    [IDL_DIR]/bin/idl_setup.bash
    [IDL_DIR]/bin/bridge_setup.bash

before you call java to run your Java-IDL-bridged program. These setup files define some critical shell environment variables, like IDL_DIR and LD_LIBRARY_PATH, whose values you may wish to inspect with a printenv call, if your errors persist.

2. Users who run the commands shown above should probably not need this step, but those who do not, like IDL for Windows users, should have the -classpath argument set in their java calls, using syntax like the below:

    java -classpath \
    ".;C:\Program Files\Exelis\IDL82\resource\bridges\external\java\javaidlb.jar" \
    my_javaidlb_program.class

In the case of IDL for Linux, Mac and Solaris, the path separator is a ":" instead of a ";". For example:

    ".:/usr/local/Exelis/idl82/resource/bridges/external/javaidlb.jar" 

3. Set in your shell the IDL_BRIDGE_DEBUG environment variable to the numeric value of 1. This will cause the BML (Bridge Middle Layer) to dump to stdout runtime debug information, including all IDL-generated output and error messages generated by IDL and the BML. The best way to temporarily set this environment variable is to use the following call:

    set IDL_BRIDGE_DEBUG=1

at the DOS prompt from which you are making your java call. The syntax for UNIX is:

# C-shell syntax:

             setenv IDL_BRIDGE_DEBUG 1   

# bash shell syntax:

    export IDL_BRIDGE_DEBUG=1   

(Unsetting IDL_BRIDGE_DEBUG, or setting it to the numeric value of 0, will turn off debug output.)

4. Is your IDL installation's 'javaidlb.jar' file in the right location?

On UNIX The 'javaidlb.jar' file absolutely needs to remain in the '[IDL_DIR]/resource/bridges/export/java/' directory, as some files required to initialize the Java Export Bridge are found based on their path relative to that location. IDL For Windows uses both the 'javaidlb.jar' location and paths stored in the Windows registry to find critical binaries. 

5. Below are some various debug flags that might help in your diagnosis. Two of these (5b and 5c) are valid flags only for Windows O.S.'s. The first flag (5a) is demonstrated with Windows paths, but the flag/argument syntax is the same for Java and IDL on UNIX machines as well.

5a) -DIDL_LOAD_DEBUG, as in:

    java -classpath ".;C:\Program Files\Exelis\IDL82\resource\bridges\external\java\javaidlb.jar" \
    -DIDL_LOAD_DEBUG my_javaidlb_program

Outputs many status reports as java tries to initialize the application.

5b) -DBMLDir, as in:

    java -classpath ".;C:\Program Files\Exelis\IDL82\resource\bridges\external\java\javaidlb.jar" \
    -DBMLDir="C:\Program Files\Exelis\IDL82\bin\bin.x86" \
    my_javaidlb_program

On Windows the Java-IDL Bridge usually tries to find the 'idl_bml.dll' path via methods (or settings) in 'idl_ebutils.dll'. The above overrides the path otherwise acquired from that file. On UNIX there is no flexibility allowed in the relative path to 'idl_bml.so', so this flag has no useful effect. On UNIX 'idl_bml.so' must be in the '../../../../bin/bin.[OS].[Chipset]/' directory relative to the directory in which 'javaidlb.jar' resides.

5c) -DJavaPALDir, as in:

    java -classpath ".;C:\Program Files\Exelis\IDL82\resource\bridges\external\java\javaidlb.jar"\
    -DJavaPALDir="C:\Program Files\Exelis\IDL82\bin\bin.x86" \
    my_javaidlb_program

On Windows the Java-IDL Bridge usually tries to find the 'javaidlb.dll' path via methods (or settings) in 'idl_ebutils.dll'. The above overrides the path otherwise acquired from that file. On UNIX this flag has no useful effect for the same reason as discussed in 4b above.

You can use all flags in one call if you want, as in:

    java -classpath ".;C:\Program Files\Exelis\IDL82\resource\bridges\external\java\javaidlb.jar"\
    -DIDL_LOAD_DEBUG \
    -DBMLDir="C:\Program Files\Exelis\IDL82\bin\bin.x86" \
    -DJavaPALDir="C:\Program Files\Exelis\IDL82\bin\bin.x86" \
    my_javaidlb_program

These examples are for 32bit IDL on Windows. They should be adjusted for 64bit IDL by replacing "bin.x86" with "bin.x86_64", or the path appropiate for your system, and where the correct path to your IDL installation should be used. For example, for 64bit IDL 8.2 on Linux using the default path you will have:

    java -classpath ".:/usr/local/Exelis/idl82/resource/bridges/external/javaidlb.jar"\
    -DIDL_LOAD_DEBUG \
    -DBMLDir="/usr/local/Exelis/idl82/bin/bin.linux.x86_64" \
    -DJavaPALDir="/usr/local/Exelis/idl82/bin/bin.linux.x86_64" \
    my_javaidlb_program

6. Create a shell (or system) environment variable named "IDL_DLM_PATH" and set its value to the path to the 32-bit binaries of your IDL installation, e.g.

    /usr/local/exelis/idl82/bin/bin.linux.x86
    or:
    C:\Program Files\Exelis\IDL82\bin\bin.x86

As an example of the syntax to set the environment variables,  please, see point 3) above. As in the previous point, this example is for 32bit IDL. It should be adjusted for 64bit IDL by replacing "bin.x86" with "bin.x86_64", see example of the path used in point 5 above.