Hi Matthias,
In which module is System.loadLibrary being invoked? Does that module
depend on any other module that exports the class
"com/sun/webkit/FileSystem"? Is that class exposed in a public API?
I think that's the way forward.
Cheers,
Antonio
El 6/4/21 a las 22:36, Matthias Bläsing escribió:
At that point the native code tries to load the class
com.sun.webkit.FileSystem via JNI Env FindClass.
In this case it fails because this code path is invoked from a new
native thread and thus java falls back to this loading procedure
I don't think the thread being invoked by a native thread has nothing to
do. My rationale (that is probably wrong, corrections welcome :-):
a) The native code/native thread tries to load the class using FindClass
on a JNIEnv.
b) This "JNIEnv" is:
JNIEnv* env = WTF::GetJavaEnv();
(https://github.com/openjdk/jfx/blob/e0ce73a3c8d82d3274bd10799b530f397a90ba60/modules/javafx.web/src/main/native/Source/WTF/wtf/java/FileSystemJava.cpp#L46)
c) Which in turn uses a "jvm" instance:
jvm->GetEnv(&env, JNI_VERSION_1_2);
(https://github.com/openjdk/jfx/blob/e0ce73a3c8d82d3274bd10799b530f397a90ba60/modules/javafx.web/src/main/native/Source/WTF/wtf/java/JavaEnv.h#L43)
d) And this "jvm" instance is populated on JNI_OnLoad (this is invoked
when System.loadLibrary is being invoked)
jvm = vm;
(https://github.com/openjdk/jfx/blob/e0ce73a3c8d82d3274bd10799b530f397a90ba60/modules/javafx.web/src/main/native/Source/WTF/wtf/java/JavaEnv.cpp#L133)
e) And from
https://docs.oracle.com/en/java/javase/13/docs/specs/jni/functions.html
If FindClass is called from a library lifecycle function hook [which is
the case, as JNI_OnLoad is being called], the class loader is determined
as follows:
for JNI_OnLoad and JNI_OnLoad_L the class loader of the class that
is loading the native library is used
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists