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 ?
This topic has been locked.
Pinned topic Liberty Profile and JNI
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Jacek_Laskowski 060001359D133 Posts
Re: Liberty Profile and JNI2013-04-02T15:31:18ZThis is the accepted answer. This is the accepted answer.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?
Japila :: verba docent, exempla trahunt
Re: Liberty Profile and JNI2013-04-02T19:41:26ZThis is the accepted answer. This is the accepted answer.
- Jacek_Laskowski 060001359D
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.
Re: Liberty Profile and JNI2013-04-05T07:47:23ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
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.