cancel
Showing results for 
Search instead for 
Did you mean: 

Error when calling shared library from UDF

Former Member
0 Kudos

Hi!

I am using some cryptographic functions in message mapping.

One of the Java classes used in UDF calls JNI library in static constructor, like this:

class IPriv_native

{

  static

  {

  System.loadLibrary("jiprivpg");

  }

..

}

When I call mapping for the first time, it works perfect.

After that every subsequent call gives an error:

Runtime exception when processing target-field mapping /ns0:MobileCoinsChargeStatus; root message: Exception:[java.lang.UnsatisfiedLinkError: Native Library /usr/sap/POD/J00/exe/libjiprivpg.so already loaded in another classloader] in class com.sap.xi.tf._MobileCoinsCheck_to_MobileCoinsCheckResult_


Is it possible to manage class loaders so that the library could be available from every UDF call?

Will it be useful to put my .jar to some folder from where it could be loaded with every Java server restart?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

The issue seems to be solved with help of SAP note 542175.

We put .jar (which is working with shared library) into some folder and put its path to Netweaver VM property "java.class.path". After that all applications are working with shared library using one common .jar which is available due to presence in java.class.path.

former_member186851
Active Contributor
0 Kudos

Andrey,

Where the share library exists?at the server level?

Former Member
0 Kudos

Yes, in a directory we created.

The directory has to be present in Netweaver VM property java.library.path (or environment variable LD_LIBRARY_PATH - in my case they have the same values).

former_member186851
Active Contributor
0 Kudos

Hello Andrey,

Why don;t you import the libraries required in the import secion of the UDF.

Former Member
0 Kudos

Hello!

I import .jar files in import section.

One of these classes uses JNI call to shared Linux library (.so file, compiled for Linux).

That causes the problem.

former_member186851
Active Contributor
0 Kudos

I guess you can try deploying it in the server as we do for Custom Bean modules.

But am not sure 100% this will work.