Sun N1 Service Provisioning System 6.0 Release Notes

Unable to Load Library Error Occurs When Calling Shared Objects (6562333)

If a shared library is called by both the Sun N1 Service Provisioning System and another application, an error similar to the following displays.


java.lang.UnsatisfiedLinkError: Unable to load library 
"/opt/SUNWn1sps/N1_Service_Provisioning_System_5.2/cli/../
common/lib/solaris/libnative.so":
"Native Library /opt/SUNWn1sps/N1_Service_Provisioning_System_5.2/
common/lib/solaris/libnative.so already loaded in another classloader". (025004)
 at 
 com.raplix.util.platform.common.PackageInfo.throwLibraryNotFound(PackageInfo.java:66)
 at com.raplix.util.platform.common.PlatformUtil.loadLibrary(PlatformUtil.java:389)
 at com.raplix.util.platform.common.LibraryLoader$Loader.create(LibraryLoader.java:27)
 at com.raplix.util.DelayedCreator.getValue(DelayedCreator.java:56)
 at com.raplix.util.platform.common.LibraryLoader.load(LibraryLoader.java:58)
 at com.raplix.util.platform.common.NativeLoader.load(NativeLoader.java:43)

This error occurs when an application and the Sun N1 Service Provisioning System CLI call the same shared object.

Workaround: Use a single CommandManager instance to call shared objects.

The following example illustrates how to call a single CommandManager instance.


/** Not thread safe */
public class CMBuilderFactory {
    public static CommandManagerBuilder builder;
    public static CommandManager mgr;

    private CMBuilderFactory() {
    }

    private static CommandManagerBuilder getBuilder() {
        if(builder == null) {
            builder = new CommandManagerBuilder();
        }

        return builder;
    }

    public static CommandManager getCommandManager() {
        if(mgr == null) {
            CommandManagerBuilder bld = getBuilder();
            bld.setCLIInstallationDirectory(..);
            ... // additional setup parameters
            mgr = bld.build();
        }

        return mgr;
    }
}