Topic
3 replies Latest Post - ‏2013-04-05T07:47:23Z by SystemAdmin
SystemAdmin
SystemAdmin
590 Posts
ACCEPTED ANSWER

Pinned topic Liberty Profile and JNI

‏2013-04-02T12:33:05Z |
Is it possible to use JNI methods in Liberty Profile ?
We have to implement small set of WebServices for a z/OS Product and investigating WLP as possible container, but have to use some JNI Libraties to access z/OS services. Is it supported ?
Thanks !
  • Jacek_Laskowski
    Jacek_Laskowski
    133 Posts
    ACCEPTED ANSWER

    Re: Liberty Profile and JNI

    ‏2013-04-02T15:31:18Z  in response to SystemAdmin
    Hi,

    I haven't heard about a special support for JNI on z/OS, and wonder what you'd expect from WebSphere Liberty Profile? Why do you think WLP would be of help for the case?

    Jacek
    Japila :: verba docent, exempla trahunt
    • SystemAdmin
      SystemAdmin
      590 Posts
      ACCEPTED ANSWER

      Re: Liberty Profile and JNI

      ‏2013-04-02T19:41:26Z  in response to Jacek_Laskowski
      Hi,
      It is possible to use JNI/native code within the liberty profile. The main issue to watch is the limitation that applies to all java programs - a native library can only be loaded once (by a single class loader) in a JVM instance, and cannot be reloaded unless that class loader is garbage collected. This means that:
      a) all access to the native library should be funneled through the same java class
      b) updates to the resource that contains the native library (application, shared library, feature) may not be dynamic

      We currently recommend that native code be packaged in common shared libraries, and that the server be recycled after any modifications to the shared library. With the beta driver for the next release of Liberty you can write your own features, and these have better support for native code. Within an OSGi bundle, you can set the Bundle-NativeCode manifest header to indicate the name of your native library as well as the os/architecture it applies to, and OSGi will load the appropriate library (this means you can bundle native code for multiple platforms in a single bundle, and ship the same code for all platforms!). Also, I'm told that equinox will handle reloading of the native library in the same JVM instance by using different locations under the covers, thus getting around the 'single load' limitation (although I admit I haven't tested that yet). With this improved support for native code in OSGi bundles coming soon, I would recommend putting such code in user features once that support is generally available.

      Regards, Alex.
      • SystemAdmin
        SystemAdmin
        590 Posts
        ACCEPTED ANSWER

        Re: Liberty Profile and JNI

        ‏2013-04-05T07:47:23Z  in response to SystemAdmin
        Alex,
        thank you for the detailed answer !

        We have a non-java product (requiring PPI communication to different zOS address spaces) and most of interfaces are only available in ASM. Now, we have to provide with OSGi integration, and the Liberty seems to be the best choice for it.