Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with JNI calls and AdoptOpenJdk 11.0.4+11 on os x #1218

Closed
Mak-Sym opened this issue Aug 13, 2019 · 1 comment
Closed

Problems with JNI calls and AdoptOpenJdk 11.0.4+11 on os x #1218

Mak-Sym opened this issue Aug 13, 2019 · 1 comment
Labels
duplicate Issues that are a duplicate of an issue in this (or another) repository

Comments

@Mak-Sym
Copy link

Mak-Sym commented Aug 13, 2019

Platform:
OS X (macOS Mojave 10.14.6)

In my application there are several libraries, which use JNI to do their job. After upgrade AdoptOpenJDK to 11.0.4+11.2, all those JNI calls result with exceptions.
Need to admin, that AdoptOpenJDK 11.0.3+7 works fine, so it looks like issue is specifically in 11.0.4.
In order to illustrate problem, I created simple app (I used JNA for simplification) and ran it different versions of AdoptOpenJDK.

Results:

OS X (macOS Mojave 10.14.6)

1.8.0_212, x86_64: "AdoptOpenJDK 8"

$ java -Djna.debug_load=true -Djna.debug_load.jna=true -jar target/jnatest-1.0-SNAPSHOT.jar osx
Aug 14, 2019 1:23:07 AM com.sun.jna.Native extractFromResourcePath
INFO: Looking in classpath from sun.misc.Launcher$AppClassLoader@3d4eac69 for /com/sun/jna/darwin/libjnidispatch.jnilib
Aug 14, 2019 1:23:07 AM com.sun.jna.Native extractFromResourcePath
INFO: Found library resource at jar:file:/Users/mfedoryshyn/Projects/Other/jnatest/target/lib/jna-5.4.0.jar!/com/sun/jna/darwin/libjnidispatch.jnilib
Aug 14, 2019 1:23:07 AM com.sun.jna.Native extractFromResourcePath
INFO: Extracting library to /Users/mfedoryshyn/Library/Caches/JNA/temp/jna3251882057131132647.tmp
Aug 14, 2019 1:23:07 AM com.sun.jna.Native loadNativeDispatchLibraryFromClasspath
INFO: Trying /Users/mfedoryshyn/Library/Caches/JNA/temp/jna3251882057131132647.tmp
Aug 14, 2019 1:23:07 AM com.sun.jna.Native loadNativeDispatchLibraryFromClasspath
INFO: Found jnidispatch at /Users/mfedoryshyn/Library/Caches/JNA/temp/jna3251882057131132647.tmp
Aug 14, 2019 1:23:07 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Looking for library 'System'
Aug 14, 2019 1:23:07 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Adding paths from jna.library.path: null
Aug 14, 2019 1:23:07 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Trying libSystem.dylib
Aug 14, 2019 1:23:07 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Found library 'System' at libSystem.dylib
[main] INFO com.myapp.App - -------------------------
[main] INFO com.myapp.App - Available pages: 3538661

11.0.3, x86_64: "AdoptOpenJDK 11" (11.0.3+7)

$ java -Djna.debug_load=true -Djna.debug_load.jna=true -jar target/jnatest-1.0-SNAPSHOT.jar osx
Aug. 14, 2019 1:07:28 AM com.sun.jna.Native extractFromResourcePath
INFO: Looking in classpath from jdk.internal.loader.ClassLoaders$AppClassLoader@799f7e29 for /com/sun/jna/darwin/libjnidispatch.jnilib
Aug. 14, 2019 1:07:28 AM com.sun.jna.Native extractFromResourcePath
INFO: Found library resource at jar:file:/Users/mfedoryshyn/Projects/Other/jnatest/target/lib/jna-5.4.0.jar!/com/sun/jna/darwin/libjnidispatch.jnilib
Aug. 14, 2019 1:07:28 AM com.sun.jna.Native extractFromResourcePath
INFO: Extracting library to /Users/mfedoryshyn/Library/Caches/JNA/temp/jna9373615060199068285.tmp
Aug. 14, 2019 1:07:28 AM com.sun.jna.Native loadNativeDispatchLibraryFromClasspath
INFO: Trying /Users/mfedoryshyn/Library/Caches/JNA/temp/jna9373615060199068285.tmp
Aug. 14, 2019 1:07:28 AM com.sun.jna.Native loadNativeDispatchLibraryFromClasspath
INFO: Found jnidispatch at /Users/mfedoryshyn/Library/Caches/JNA/temp/jna9373615060199068285.tmp
Aug. 14, 2019 1:07:28 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Looking for library 'System'
Aug. 14, 2019 1:07:28 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Adding paths from jna.library.path: null
Aug. 14, 2019 1:07:28 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Trying libSystem.dylib
Aug. 14, 2019 1:07:28 AM com.sun.jna.NativeLibrary loadLibrary
INFO: Found library 'System' at libSystem.dylib
[main] INFO com.myapp.App - -------------------------
[main] INFO com.myapp.App - Available pages: 3447488

11.0.4, x86_64: "AdoptOpenJDK 11" (11.0.4+11)
(openjdk 11.0.4 2019-07-16
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.4+11))

$ java -Djna.debug_load=true -Djna.debug_load.jna=true -jar target/jnatest-1.0-SNAPSHOT.jar osx
Aug. 14, 2019 1:24:55 AM com.sun.jna.Native extractFromResourcePath
INFO: Looking in classpath from jdk.internal.loader.ClassLoaders$AppClassLoader@4b85612c for /com/sun/jna/darwin/libjnidispatch.jnilib
Aug. 14, 2019 1:24:55 AM com.sun.jna.Native extractFromResourcePath
INFO: Found library resource at jar:file:/Users/mfedoryshyn/Projects/Other/jnatest/target/lib/jna-5.4.0.jar!/com/sun/jna/darwin/libjnidispatch.jnilib
Aug. 14, 2019 1:24:55 AM com.sun.jna.Native extractFromResourcePath
INFO: Extracting library to /Users/mfedoryshyn/Library/Caches/JNA/temp/jna9413857741581317107.tmp
Aug. 14, 2019 1:24:55 AM com.sun.jna.Native loadNativeDispatchLibraryFromClasspath
INFO: Trying /Users/mfedoryshyn/Library/Caches/JNA/temp/jna9413857741581317107.tmp
[main] ERROR com.myapp.App - Major error:
java.lang.UnsatisfiedLinkError: /Users/mfedoryshyn/Library/Caches/JNA/temp/jna9413857741581317107.tmp: dlopen(/Users/mfedoryshyn/Library/Caches/JNA/temp/jna9413857741581317107.tmp, 1): no suitable image found.  Did find:
	/Users/mfedoryshyn/Library/Caches/JNA/temp/jna9413857741581317107.tmp: code signature in (/Users/mfedoryshyn/Library/Caches/JNA/temp/jna9413857741581317107.tmp) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
	at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
	at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2430)
	at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)
	at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2617)
	at java.base/java.lang.Runtime.load0(Runtime.java:767)
	at java.base/java.lang.System.load(System.java:1831)
	at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018)
	at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
	at com.sun.jna.Native.<clinit>(Native.java:195)
	at com.sun.jna.Structure.setAlignType(Structure.java:280)
	at com.sun.jna.Structure.<init>(Structure.java:197)
	at com.sun.jna.Structure.<init>(Structure.java:193)
	at com.sun.jna.Structure.<init>(Structure.java:180)
	at com.sun.jna.Structure.<init>(Structure.java:172)
	at com.sun.jna.platform.mac.SystemB$VMStatistics.<init>(SystemB.java:111)
	at com.myapp.MacOSMemoryStats.stat(App.java:72)
	at com.myapp.MacOSMemoryStats.stat(App.java:64)
	at com.myapp.App.main(App.java:48)

I also checked Windows (Microsoft Windows Server 2019 Datacenter), but it seems it works fine on PC.

Please describe the issue that you are having with our binaries and if possible how to recreate it.

@Mak-Sym
Copy link
Author

Mak-Sym commented Aug 13, 2019

Oh, just found this one after creating report: #1211

Sorry

@Mak-Sym Mak-Sym closed this as completed Aug 13, 2019
@karianna karianna added the duplicate Issues that are a duplicate of an issue in this (or another) repository label Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues that are a duplicate of an issue in this (or another) repository
Projects
None yet
Development

No branches or pull requests

2 participants