Hi Rémy,

for which Java version and distribution is this? The docs for Java 7 and 8 are much less precise about return codes than the cited docs for Java 9. So older versions might give a generic error. The used code for checking versions is in the HotSpot sources for version 8 inside hotspot/src/share/vm/runtime/thread.cpp (functions Threads::is_supported_jni_version_including_1_1 and Threads::is_supported_jni_version):

jboolean Threads::is_supported_jni_version_including_1_1(jint version) {
  if (version == JNI_VERSION_1_1) return JNI_TRUE;
  return is_supported_jni_version(version);
}

It is called from hotspot/src/share/vm/prims/jni.cpp in jni_GetEnv().

I don't see a code path returning -1 in the version I am looking at (outdated Java 8 source code).

What is rather special about that environment w.r.t. platform/JVM/Arch or so?

Regards,

Rainer

Am 10.07.2019 um 20:42 schrieb Rémy Maucherat:
Hi,

I'm a bit stumped there, as I'm trying to get native to work in that rather special environment.

JNI_OnLoad fails with:
WARNING: The APR based Apache Tomcat Native library failed to load. The error reported was [Unsupported JNI version 0xffffffff, required by bin/libtcnative-1.so.0.2.23] java.lang.UnsatisfiedLinkError: Unsupported JNI version 0xffffffff, required by bin/libtcnative-1.so.0.2.23 at com.oracle.svm.jni.JNILibraryInitializer.initialize(JNILibraryLoadFeature.java:87) at com.oracle.svm.core.jdk.NativeLibrarySupport.loadLibrary0(NativeLibrarySupport.java:153) at com.oracle.svm.core.jdk.NativeLibrarySupport.loadLibrary(NativeLibrarySupport.java:98)
at java.lang.ClassLoader.loadLibrary(Target_java_lang_ClassLoader.java:126)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.Runtime.load(Runtime.java:241)
at java.lang.System.load(System.java:366)
at org.apache.tomcat.jni.Library.<init>(Library.java:42)

Although this looks weird, this is actually returning -1 and it's normal when it fails [it's a bad error message]. Most likely this doesn't work:
     if ((*vm)->GetEnv(vm, &ppe, JNI_VERSION_1_4)) {
         return JNI_ERR;
     }

Any ideas ?

Rémy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to