JDK-8225425 : java.lang.UnsatisfiedLinkError: net.dll: Can't find dependent libraries
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 8u202,11.0.2,13,14
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2019-06-03
  • Updated: 2022-06-27
  • Resolved: 2019-08-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14 JDK 7 JDK 8 Other
11.0.5-oracleFixed 13.0.1Fixed 14 b11Fixed 7u241Fixed 8u231Fixed openjdk7uFixed
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
Java 8 update 202 +  is installed into a docker image, based on mcr.microsoft.com/powershell:nanoserver-1809 (nanoserver)

A DESCRIPTION OF THE PROBLEM :
Most likely this is a confirmation of the issue https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8218486 (could not find how to re-open it).

We're using windows/nanoserver as a base docker image for our application (TeamCity server), and we install OpenJDK8 to run it.

Since Java update 202, all OpenJDK 8 packages from different vendors (AdoptOpenJDK, AmazonCorretto) fail with the same exception when trying to start Apache Tomcat under nanoserver image.



REGRESSION : Last worked in version 8u192

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- build docker image with JDK based on mcr.microsoft.com/powershell:nanoserver-1809 (or any other windows nanoserver image)
- add Apache tomcat into this image
- Start docker container based on this image

Sample start of the Dockerfile:
```
FROM mcr.microsoft.com/powershell:nanoserver-1809 AS base

SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# Install JRE
RUN [Net.ServicePointManager]::SecurityProtocol = 'tls12, tls11, tls' ; \
    Invoke-WebRequest https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u212-b03/OpenJDK8U-jre_x64_windows_hotspot_8u212b03.zip -OutFile jre.zip; \
    Expand-Archive jre.zip -DestinationPath $Env:ProgramFiles\Java ; \
    Get-ChildItem $Env:ProgramFiles\Java | Rename-Item -NewName "OpenJDK" ; \
    Remove-Item -Force jre.zip

```


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Process starts successfully.
ACTUAL -
Exception like:

java.lang.UnsatisfiedLinkError: C:\Program Files\Java\OpenJDK\bin\net.dll: Can't find dependent libraries
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1845)
        at java.lang.Runtime.loadLibrary0(Runtime.java:870)
        at java.lang.System.loadLibrary(System.java:1122)
        at sun.nio.ch.IOUtil$1.run(IOUtil.java:359)
        at sun.nio.ch.IOUtil$1.run(IOUtil.java:357)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.nio.ch.IOUtil.<clinit>(IOUtil.java:356)
        at sun.nio.ch.FileChannelImpl.<clinit>(FileChannelImpl.java:1218)
        at sun.management.ManagementFactoryHelper.getBufferPoolMXBeans(ManagementFactoryHelper.java:214)
        at java.lang.management.PlatformComponent$11.getMXBeans(PlatformComponent.java:215)
        at java.lang.management.PlatformComponent.getMXBeans(PlatformComponent.java:377)
        at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:472)
        at org.apache.tomcat.util.modeler.Registry.getMBeanServer(Registry.java:440)
        at org.apache.catalina.mbeans.MBeanUtils.createServer(MBeanUtils.java:576)
        at org.apache.catalina.mbeans.MBeanUtils.<clinit>(MBeanUtils.java:77)
        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.<clinit>(GlobalResourcesLifecycleListener.java:66)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:117)
        at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1250)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
        at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
        at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1518)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:611)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:662)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:309)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)

CUSTOMER SUBMITTED WORKAROUND :
Use jdk8u192-b12 instead of 202 or 212.

FREQUENCY : always



Comments
Fix Request (8u, critical) This fixes Java failure on nanoserver images. Patch does not apply to 8u. 8u RFR, patch, discussion: https://mail.openjdk.java.net/pipermail/jdk8u-dev/2019-September/010252.html
10-09-2019

Fix Request (11u, critical) This fixes Java failure on nanoserver images. Patch does apply cleanly to 11u, but test requires URIBuilder from JDK-8220575. Passes the tests afterwards. 11u RFR: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2019-September/001829.html
04-09-2019

URL: https://hg.openjdk.java.net/jdk/jdk/rev/56df9a08ed9c User: chegar Date: 2019-08-19 13:29:45 +0000
19-08-2019

Provisional fix: http://cr.openjdk.java.net/~chegar/8225425/webrev.01/ An unfortunate eager dependency on urlmon.dll has crept into net.dll. The dependency should be made lazy and optional.
16-08-2019

So this affects jdk/jdk as well, right? Needs to be fixed in all current releases then, adding affected versions.
15-08-2019

Confirmed / Reproduced the issue, on Windows Server 2016 with the urlmon.dll temporary removed: $ cat Test.java public class Test { public static void main(String... args) { java.net.InetAddress.getLoopbackAddress(); } } $ ./build/windows-x64/images/jdk/bin/java Test.java Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\cygwin64\home\chhegar\repos\jdk\open\build\windows-x64\images\jdk\bin\net.dll: Can't find dependent libraries at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method) at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2440) at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2497) at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694) at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2648) at java.base/java.lang.System$2.loadLibrary(System.java:2280) at java.base/jdk.internal.loader.BootLoader.loadLibrary(BootLoader.java:136) at java.base/sun.nio.fs.WindowsNativeDispatcher.<clinit>(WindowsNativeDispatcher.java:1155) at java.base/sun.nio.fs.WindowsChannelFactory.open(WindowsChannelFactory.java:308) at java.base/sun.nio.fs.WindowsChannelFactory.newFileChannel(WindowsChannelFactory.java:168) at java.base/sun.nio.fs.WindowsFileSystemProvider.checkReadAccess(WindowsFileSystemProvider.java:330) at java.base/sun.nio.fs.WindowsFileSystemProvider.checkAccess(WindowsFileSystemProvider.java:367) at java.base/sun.nio.fs.AbstractFileSystemProvider.exists(AbstractFileSystemProvider.java:151) at java.base/java.nio.file.Files.exists(Files.java:2513) at jdk.compiler/com.sun.tools.javac.launcher.Main.getFile(Main.java:213) at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:186) at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:132)
15-08-2019

dumpbin.exe /DEPENDENTS binaries/jdk1.8.0_221/jre/bin/net.dll Microsoft (R) COFF/PE Dumper Version 14.16.27026.1 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file binaries\jdk1.8.0_221\jre\bin\net.dll File Type: DLL Image has the following dependencies: WS2_32.dll jvm.dll urlmon.dll <<<<< HERE java.dll ADVAPI32.dll MSVCR100.dll KERNEL32.dll Image has the following delay load dependencies: Secur32.dll IPHLPAPI.DLL Summary 1000 .data 1000 .pdata 6000 .rdata 1000 .reloc 1000 .rsrc F000 .text --- With a build from the mainline jdk/jdk: dumpbin.exe /DEPENDENTS repos/jdk/open/build/windows-x64/images/jdk/bin/net.dll Microsoft (R) COFF/PE Dumper Version 14.16.27026.1 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file repos\jdk\open\build\windows-x64\images\jdk\bin\net.dll File Type: DLL Image has the following dependencies: WS2_32.dll jvm.dll WINHTTP.dll urlmon.dll java.dll ADVAPI32.dll KERNEL32.dll VCRUNTIME140.dll api-ms-win-crt-string-l1-1-0.dll api-ms-win-crt-stdio-l1-1-0.dll api-ms-win-crt-heap-l1-1-0.dll api-ms-win-crt-runtime-l1-1-0.dll Image has the following delay load dependencies: Secur32.dll IPHLPAPI.DLL Summary 1000 .data 1000 .pdata 6000 .rdata 1000 .reloc 1000 .rsrc E000 .text
15-08-2019

Probably caused by CPU fix that added urlmon.dll here? https://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/d0d0b71e3a2a#l1.8
08-08-2019

Tried to reproduce the issue using the Dockerfile provided by submitter, but getting an error and not able to proceed: Using the Dockerfile provided in your email below , I got the below error due to which I am not able to reproduce the issue. Please let me know if you have any inputs to rectify this. C:\Triaging>docker build -t jdk8image . Sending build context to Docker daemon 746.4MB Step 1/6 : FROM mcr.microsoft.com/powershell:nanoserver-1803 ---> 3639e28efffc Step 2/6 : COPY ["jdk1.8.0_212", "/Program Files/Java/OpenJDK/"] ---> 2f81ea3425ad Step 3/6 : COPY apache-tomcat-9.0.22 /TeamCity/ ---> 9b2edf09a3e0 Step 4/6 : ENV JRE_HOME="C:\Program Files\Java\OpenJDK" ---> Running in 03c66e0c74e5 Removing intermediate container 03c66e0c74e5 ---> d8067b0580b8 Step 5/6 : WORKDIR /TeamCity/apache-tomcat-9.0.22/bin/ ---> Running in 179ed48fc087 Removing intermediate container 179ed48fc087 ---> c0c878d3a3f0 Step 6/6 : CMD ["catalina.bat", "run"] ---> Running in a2110723d151 Removing intermediate container a2110723d151 ---> 7036d61d8662 Successfully built 7036d61d8662 Successfully tagged jdk8image:latest C:\Triaging>docker run -ti --rm jdk8image docker: Error response from daemon: container 28310b59e2ae81bc1fd189f15ffe90177088811930075e35ec5833846723a50d encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) [Event Detail: Provider: 00000000-0000-0000-0000-000000000000] [Event Detail: Provider: 00000000-0000-0000-0000-000000000000] [Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(174)\vmcomputeagent.exe!00007FF74C3AC00A: (caller: 00007FF74C37ECEA) Exception(2) tid(370) 80070002 The system cannot find the file specified. CallContext:[\Bridge_ProcessMessage\ComputeSystemManager_ExecuteProcess\VmHostedContainer_ExecuteProcess] Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandLine":"catalina.bat run","User":"ContainerUser","WorkingDirectory":"C:\\TeamCity\\apache-tomcat-9.0.22\\bin","Environment":{"JRE_HOME":"C:\\Program Files\\Java\\OpenJDK","LOCALAPPDATA":"C:\\Users\\ContainerAdministrator\\AppData\\Local","PSCORE":"\\PowerShell\\pwsh.exe","PSModuleAnalysisCachePath":"\\Microsoft\\Windows\\PowerShell\\docker\\ModuleAnalysisCache","ProgramFiles":"C:\\Program Files"},"EmulateConsole":true,"CreateStdInPipe":true,"CreateStdOutPipe":true,"ConsoleSize":[41,172]}.
18-07-2019

From submitter: Additional Information: I confirm that the same problem also exists with Oracle JDK 8u212. The docker file may look like this (given that you have JDK and unpacked Tomcat distribution in the Dockerfile directory, see COPY commands): ------------------------- # docker build -t xxx . # docker run -ti --rm xxx FROM mcr.microsoft.com/powershell:nanoserver-1803 COPY ["jdk1.8.0_212", "/Program Files/Java/OpenJDK/"] COPY apache-tomcat-8.5.42 /TeamCity/ ENV JRE_HOME="C:\Program Files\Java\OpenJDK" WORKDIR /TeamCity/apache-tomcat-8.5.42/bin/ CMD ["catalina.bat", "run"] ---------------------------
18-06-2019

Interestingly the submitter mentions several 8u distributions but not Oracle's. Are we sure that this is an issue with the Oracle distribution? Is it possible for the submitter to try with JDK 11?
15-06-2019