Spring Boot 不能加载 tcnative-2.dll 库(Can't load library: tcnative-2.dll)

Spring Boot 不能加载 tcnative-2.dll 库

本文将介绍怎样解决 Spring Boot 在启动时抛出 “org.apache.tomcat.jni.LibraryNotFoundError: Can't load library: *\tcnative-2.dll”错误。

在使用SpringBoot3创建项目的过程中,将日志的级别调为debug,日志打印了 “org.apache.tomcat.jni.LibraryNotFoundError: Can't load library: *\tcnative-2.dll”错误。

2024-06-06T15:22:33.222+08:00 DEBUG 19352 --- [           main] o.a.catalina.core.AprLifecycleListener   : The Apache Tomcat Native library could not be found using names [tcnative-2, libtcnative-2, tcnative-1, libtcnative-1] on the java.library.path [E:\SDK\Java\temurin\jdk-17.0.10+7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;E:\Git\cmd;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;E:\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;C:\Users\zjw\AppData\Local\JetBrains\Toolbox\scripts;;.]. The errors reported were [Can't load library: E:\code\IdeaProjects\lease\bin\tcnative-2.dll, Can't load library: E:\code\IdeaProjects\lease\bin\libtcnative-2.dll, Can't load library: E:\code\IdeaProjects\lease\bin\tcnative-1.dll, Can't load library: E:\code\IdeaProjects\lease\bin\libtcnative-1.dll, no tcnative-2 in java.library.path: E:\SDK\Java\temurin\jdk-17.0.10+7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;E:\Git\cmd;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;E:\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;C:\Users\zjw\AppData\Local\JetBrains\Toolbox\scripts;;., no libtcnative-2 in java.library.path: E:\SDK\Java\temurin\jdk-17.0.10+7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;E:\Git\cmd;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;E:\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;C:\Users\zjw\AppData\Local\JetBrains\Toolbox\scripts;;., no tcnative-1 in java.library.path: E:\SDK\Java\temurin\jdk-17.0.10+7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;E:\Git\cmd;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;E:\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;C:\Users\zjw\AppData\Local\JetBrains\Toolbox\scripts;;., no libtcnative-1 in java.library.path: E:\SDK\Java\temurin\jdk-17.0.10+7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;E:\Git\cmd;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;E:\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;C:\Users\zjw\AppData\Local\JetBrains\Toolbox\scripts;;.]

org.apache.tomcat.jni.LibraryNotFoundError: Can't load library: E:\code\IdeaProjects\lease\bin\tcnative-2.dll, Can't load library: E:\code\IdeaProjects\lease\bin\libtcnative-2.dll, Can't load library: E:\code\IdeaProjects\lease\bin\tcnative-1.dll, Can't load library: E:\code\IdeaProjects\lease\bin\libtcnative-1.dll, no tcnative-2 in java.library.path: E:\SDK\Java\temurin\jdk-17.0.10+7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;E:\Git\cmd;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;E:\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;C:\Users\zjw\AppData\Local\JetBrains\Toolbox\scripts;;., no libtcnative-2 in java.library.path: E:\SDK\Java\temurin\jdk-17.0.10+7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;E:\Git\cmd;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;E:\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;C:\Users\zjw\AppData\Local\JetBrains\Toolbox\scripts;;., no tcnative-1 in java.library.path: E:\SDK\Java\temurin\jdk-17.0.10+7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;E:\Git\cmd;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;E:\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;C:\Users\zjw\AppData\Local\JetBrains\Toolbox\scripts;;., no libtcnative-1 in java.library.path: E:\SDK\Java\temurin\jdk-17.0.10+7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;E:\Git\cmd;C:\Windows\system32;E:\SDK\Java\temurin\jdk-21.0.2+13\bin;C:\Windows;E:\apache\apache-maven-3.9.6\bin;E:\mysql\bin;E:\dotnet;E:\pnpm;E:\nvm;E:\nodejs;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;E:\platform-tools;C:\ProgramData\chocolatey\bin;D:\NetSarang\Xshell\;D:\NetSarang\Xftp\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;E:\TortoiseSVN\bin;D:\Snipaste;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Docker\Docker\resources\bin;E:\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\zjw\AppData\Local\Programs\Ollama;E:\VSCode;C:\Program Files\WireGuard\;E:\Python\Python311;E:\Python\Python311\Scripts;E:\gradle\gradle-8.7\bin;E:\nvm;C:\Users\zjw\AppData\Local\JetBrains\Toolbox\scripts;;.
	at org.apache.tomcat.jni.Library.<init>(Library.java:91) ~[tomcat-embed-core-10.1.24.jar:10.1.24]
	at org.apache.tomcat.jni.Library.initialize(Library.java:147) ~[tomcat-embed-core-10.1.24.jar:10.1.24]
	at org.apache.catalina.core.AprLifecycleListener.init(AprLifecycleListener.java:189) ~[tomcat-embed-core-10.1.24.jar:10.1.24]
	at org.apache.catalina.core.AprLifecycleListener.isAprAvailable(AprLifecycleListener.java:106) ~[tomcat-embed-core-10.1.24.jar:10.1.24]
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getDefaultServerLifecycleListeners(TomcatServletWebServerFactory.java:191) ~[spring-boot-3.3.0.jar:3.3.0]
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.<init>(TomcatServletWebServerFactory.java:138) ~[spring-boot-3.3.0.jar:3.3.0]
	at org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryConfiguration$EmbeddedTomcat.tomcatServletWebServerFactory(ServletWebServerFactoryConfiguration.java:73) ~[spring-boot-autoconfigure-3.3.0.jar:3.3.0]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140) ~[spring-beans-6.1.8.jar:6.1.8]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644) ~[spring-beans-6.1.8.jar:6.1.8]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636) ~[spring-beans-6.1.8.jar:6.1.8]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1337) ~[spring-beans-6.1.8.jar:6.1.8]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1167) ~[spring-beans-6.1.8.jar:6.1.8]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562) ~[spring-beans-6.1.8.jar:6.1.8]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-6.1.8.jar:6.1.8]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337) ~[spring-beans-6.1.8.jar:6.1.8]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.8.jar:6.1.8]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335) ~[spring-beans-6.1.8.jar:6.1.8]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205) ~[spring-beans-6.1.8.jar:6.1.8]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:223) ~[spring-boot-3.3.0.jar:3.3.0]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:186) ~[spring-boot-3.3.0.jar:3.3.0]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-3.3.0.jar:3.3.0]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:618) ~[spring-context-6.1.8.jar:6.1.8]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.3.0.jar:3.3.0]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.3.0.jar:3.3.0]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.3.0.jar:3.3.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) ~[spring-boot-3.3.0.jar:3.3.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.0.jar:3.3.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.0.jar:3.3.0]
	at com.zjw.lease.AdminWebApplication.main(AdminWebApplication.java:17) ~[classes/:na]

为什么要去加载 tcnative-2.dll 库呢?

因为 Tomcat 中的 connector 为了提高性能,采用了加载与操作系统绑定(非跨平台)的本地库的方式,比如:Windows 系统中就是 .dll 动态链接库。

默认会去 Tomcat 的 bin 目录下去找,但是由于 Spring Boot 的 Tomcat 是嵌入式的,没有这些 .dll,所以需要自己去官网下载,并解压放到 C:\Windows\System32\ 目录下。

什么是 Tomcat Native?

Apache Tomcat Native Library 是与 Apache Tomcat 一起使用的可选组件,它允许 Tomcat 使用 Open SSL 作为 JSSE 的替代品来支持 TLS 连接。说白了,Tomcat Native 就是一套和操作系统紧密结合的库,不同类型的操作系统 Tomcat Native 就会不同,如:Windows 下就是动态链接库,Linux 系统就是 .so 库文件。使用 Tomcat Native 可以调用操作系统底层的能力,提升 Tomcat 的性能。

更多关于 Tomcat Native 的信息,请参考:https://tomcat.apache.org/native-doc/

下载 Tomcat Native

访问 https://archive.apache.org/dist/tomcat/tomcat-connectors/native/2.0.6/binaries/ 地址,下载 Tomcat Native,然后解压压缩包。将 tcnative-1.dll 和 openssl.exe 拷贝到 C:\Windows\System32\ 目录下。如下图:


原文:https://www.hxstrive.com/article/1201.htm

posted @ 2024-06-06 15:24  雨中遐想  阅读(591)  评论(0编辑  收藏  举报