org.apache.tomcat.jni.LibraryNotFoundError: Can't load library: C:\xx\bin\tcnative-1.dll解决办法

开发环境:Windows10(未报错)

线上环境:Windows Server 2012(报以下错)

线上部署SpringBoot项目时,启动程序,发现Dubbo服务注入不了,报空指针异常。后来发现启动时中间报了一个错,如下:

org.apache.tomcat.jni.LibraryNotFoundError: Can't load library: C:\project\xx\bin\tcnative-1.dll, 
Can't load library: C:\project\xx\bin\libtcnative-1.dll,
no tcnative-1 in java.library.path, no libtcnative-1 in java.library.path
        at org.apache.tomcat.jni.Library.(Library.java:102) ~[tomcat-embed-core-9.0.16.jar!/:9.0.16]

这是tomcat没有找到JNI动态链接库。用Everything一搜Tomcat下是有这个dll的,启动时在Springboot中内嵌Tomcat下没有找到吧。

org.apache.tomcat.jni.LibraryNotFoundError: Can't load library: C:\xx\bin\tcnative-1.dll解决办法_第1张图片

解决办法:

直接将tomcat下的tcnative-1.dll放到C:\Windows\System32下,重新启动项目即可。

org.apache.tomcat.jni.LibraryNotFoundError: Can't load library: C:\xx\bin\tcnative-1.dll解决办法_第2张图片

org.apache.tomcat.jni.LibraryNotFoundError: Can't load library: C:\xx\bin\tcnative-1.dll解决办法_第3张图片

你可能感兴趣的:(SpringBoot,Tomcat,Tomcat,Springboot)