3.3 KiB
CheerpJ 5.0 / Java 11: missing JVM_LoadLibrary import for System.loadLibrary()
Status: Reproducible with a minimal application independent of customer or vendor code.
CheerpJ: Core 5.0, OpenJDK 11.0.33-internal (according to Java console output).
Server JDK: Java 11 on Payara/GlassFish (independent of browser JVM).
Java classfile: 55 (javac --release 11).
Browser: Edge/Chromium (as reported by customer). Additional Firefox verification not available.
Minimal reproduction steps
The included NativeLoaderSmoke.java and wwprobe.js are vendor-independent.
Compile the Java class for Java 11, serve the JAR with HTTP Range support, serve
wwprobe.js as an ES module. Configure:
await cheerpjInit({
version: 11,
javaProperties: ["java.library.path=/app/backend/hmi/cheerpj/natives"],
});
await cheerpjRunMain(
"com.widgetworkbench.cheerpj.NativeLoaderSmoke",
"/app/backend/hmi/cheerpj/jaas-native-loader-smoke.jar",
"wwprobe"
);
Native module (wwprobe.js):
export default {
async Java_com_widgetworkbench_cheerpj_NativeLoaderSmoke_ping() {
return 42;
}
};
The Java program executes System.loadLibrary("wwprobe") and then calls
its private static native int ping() method.
Actual output:
[NATIVE-LOADER] java.version=11.0.33-internal
[NATIVE-LOADER] java.library.path=/app/backend/hmi/cheerpj/natives
[NATIVE-LOADER] about to System.loadLibrary("wwprobe")
JVM_FindLibraryEntry: JNI_OnLoad_wwprobe
JVM_FindLibraryEntry: JNI_OnLoad_wwprobe
Missing import: JVM_LoadLibrary
java.lang.UnsatisfiedLinkError: no wwprobe in java.library.path
Expected: System.loadLibrary("wwprobe") loads the JS module and the
subsequent native call returns 42.
Control test: Using cheerpjInit({ natives: wwprobeNativeHandlers })
with the same native function and without System.loadLibrary() works:
[NATIVE-LOADER] NATIVE_CALL_RESULT=42
[NATIVE-LOADER] PASS DIRECT_NATIVES
Java-Exit-Code: 0
The same JVM_LoadLibrary error occurs for System.loadLibrary("jaas"),
which the Java 11 JDK class com.sun.security.auth.module.UnixSystem
performs in its constructor.
Questions for Leaning Technologies
- Is
System.loadLibraryof JavaScript ES modules supported in CheerpJ 5.0 with OpenJDK 11? If so, are any additionalcheerpjInitflags/imports required? - Is
Missing import: JVM_LoadLibrarya known issue in the runtime's OpenJDK 11 native library loader? Is there a patch, fixed build, or documented workaround? - Does the Java 11
jdk.security.authmodule'sUnixSystemwork under CheerpJ without using a synthetic OS identity? What is the recommended virtual OS identity approach? - Are there specific HTTP-Range or caching requirements for the CDN resource
/5.0/11/lib/modules? An Edge session producedERR_CACHE_OPERATION_NOT_SUPPORTED, but it is not proven to be causal. - Can you provide a supported browser-side extension mechanism to satisfy the UnixSystem constructor without editing vendor application JARs?
Scope and exclusions
The original MES application JARs and its authentication process are untouched.
The test needs no customer database, internal server, iTAC classes, user credentials,
or workstation-specific identity. The generated Java bridge mode is a separate
non-production diagnostic of a synthetic identity helper; it is not a fix for
System.loadLibrary.