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
awt.dll Can't find dependent libraries on windows server 2019 (JDK 11) #135
Comments
@karianna In #32 (same problem, but on JDK 8) you indicated the problem should be resolved by moving up to VS 2017. AdoptOpenJDK 11 is on VS 2017 and the problem persists, so it does not seem that this is the solution. Having to install the redistributables indicates that we either don't bundle some DLLs that we should or we're linking against the wrong versions. Do you have an expert handy that can look into this or at least talk me through diagnosing this? The latter would have the advantage that I'd learn something which could come handy in the future. |
I've asked @d3r3kk to look into this whole stack this quarter - but he'll be weighing this up against his other priorities :-). Might be worth starting a discussion on slack with all of us. |
Hi, I am digging a bit inside the problem: |
And I have the same issue with Zulu JDK 11 and Oracle JDK 11. |
@edonin Super helpful, thanks a lot. |
This seems to turn into another wild goose chase 😞. I could not reproduce the behaviour on Windows Server 2019 with almost nothing installed, neither with AdoptOpenJDK 11 nor AdoptOpenJDK 8. Any ideas? Full details below. AdoptOpenJDK 11 JRE:
Same machine, AdoptOpenJDK 8 JRE:
The test program:
|
Thanks for your time @aahlenst. It seems that the awt.dll was well loaded when I asked to load the jvm.dll (where the JNI_CreateJavaVM is located), but not some of its dependent library. |
@edonin Can you produce something like https://github.com/aahlenst/datetimeformatter-parse-bug for us? That would be most helpful. |
@aahlenst : I will try to take a look, after. Neverthless, I could give you my finds: Our C java wrapper for windows is doing the following (very simplified):
It used to work with Oracle JDK 8, but it is no more working with openJDK 8 or 11 (I have just tested openjdk8).
What I understood (sorry I am not a C/C++ dev, so I might be wrong), is when the JVM is initializing the java.awt.Toolkit class, we have some System.loadLibrary("awt") to execute. That will trigger the code in hotspot/share/runtime/os.cpp
And the windows implementation of the dll_load function is localised in hotspot/os/windows/os_windows.cpp
So, from my understanding, hotspot is able to to figure out that the awt.dll is localized in my jre\bin directory and is able to load it, even in the jre\bin path is no more in the search dll path. It explains:
For me, I have a workaround by do not calling SetDllDirectory(0) after loading the jvm.dll library, but a more lasting solution could be to execute SetDllDirectory(dll_path) inside the os_windows.cpp at startup to be sure that the dll directory will be present in the default dll path. Moreover, here is the windows documentation about the dll path search : https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setdlldirectorya What do you think ? |
This is not my area of expertise. I haven't found any recommendations, either.
I'm curious: Why are you doing it in the first place?
Reading the Microsoft docs, that would not help: If you pass |
It is a old code, and I was not responsible of it :) The only info I could find is the commit message
I agree. But i do not understand how it was working with Oracle JDK 8... |
A lot of things were different back then. Are you happy with closing the issue or is there anything left to do? |
It is ok for me to close it. |
I was getting this error trying to start a Java application wrapped in an Apache Commons Daemon Procrun exe using Zulu Community JDK 11.0.11+9 x86_64 (or amd_64) edition. My first work-around was to open a Command Prompt first, manually reset the PATH so it included my application's jre/bin folder (and no other jre/bin folder), and then run my exe, e.g. "C:\Program Files\MyApp\MyJavaServiceWrapper.exe". I was able to resolve this issue by upgrading my Apache Commons Daemon Procrun EXE from version 1.0.15.0 to version 1.2.4.0. |
Hi,
I am trying to run the adopt openjdk 11 (Hotspot + only JRE) on windows server 2019.
The first time i am trying to use awt, i got an exception :
Caused by: java.lang.UnsatisfiedLinkError: F:\XXXX\jre\bin\awt.dll: Can't find dependent libraries
at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
at java.base/java.lang.ClassLoader$NativeLibrary.load(Unknown Source)
at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(Unknown Source)
at java.base/java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.base/java.lang.Runtime.loadLibrary0(Unknown Source)
at java.base/java.lang.System.loadLibrary(Unknown Source)
at java.desktop/java.awt.Toolkit$3.run(Unknown Source)
at java.desktop/java.awt.Toolkit$3.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/java.awt.Toolkit.loadLibraries(Unknown Source)
at java.desktop/java.awt.Toolkit.(Unknown Source)
at java.desktop/java.awt.Color.(Unknown Source)
It is reproducable with jdk-11.0.7+10.2 and jdk-11.0.6+10 (both hotsport and JRE)
It is a fresh and up-to-date windows server 2019.
Manually installing the microsoft Visual C++ redistributable for Visual Studio 2015, 2017 and 2019 fixes the issue, but I prefer to have a JDK that does not have any pre-requesites.
The text was updated successfully, but these errors were encountered: