Summary
When Java applications that depend on Defense Solutions MOLE/Military Analyst libraries are run on Linux with ArcGIS 10, the following error displays when invoking objects from these libraries:
"[java] AutomationException: 0x80040154 - Class not registered"
Instructions provided describe the workaround, which is to force the load of these libraries at runtime using a JNI call.
Procedure
The files in this folder create a library called 'libdefsolinitializer.so', which is needed to create DefenseSolutions (MOLE or Military Analyst) objects in Java in ArcGIS Engine releases starting at ArcGIS Defense Solutions 10.
This folder contains/builds a C library that acts as a Java Native Interface (JNI) wrapper to call the required C-initialization method 'DSInitialize'.
The 'Makefile' builds and copies the library, 'libdefsolinitializer.so', to $ARCGISENGINEHOME/bin. If this library needs to be placed in another location, the following must be added to the location/folder: LD_LIBRARY_PATH.
Requirements: ArcGIS Engine Runtime + CPPAPI + Java.
- Run 'make' from the $ARCGISENGINEHOME/bin folder. This builds 'libdefsolinitializer.so' and copies it to $ARCGISENGINEHOME/bin.
If the ArcGIS Engine CPPAPI is not installed or a C build environment is not configured, a pre-built library file has been provided: libdefsolinitializer.so-prebuilt. Rename this file to libdefsolinitializer.so and manually copy it to $ARCGISENGINEHOME/bin. This pre-built binary has been tested only on a Redhat 4, 32-bit machine.
MA-MOLE-10-LinuxWorkaround
- Insert the following code to the project or add the provided file DefSolInitializer.java to the project:
package arcgissamples.defensesolutions;
public class DefSolInitializer {
/* Native method declaration */
public native void initDefSol(); // needed to load COM types after 9.3.1
/* Use static intializer */
static {
System.loadLibrary("defsolinitializer");
}
} - From the Java application requiring Defense Solution(MOLE/MA) libraries, add this code immediately after the call to AOInitialize().initialize:
// Force load of Defense Solution Libraries:
new arcgissamples.defensesolutions.DefSolInitializer().initDefSol();