gpt4 book ai didi

java - Leadtools.RasterException : Native Library Ltkrnx. dll 已加载到另一个类加载器中

转载 作者:行者123 更新时间:2023-12-02 05:38:35 27 4
gpt4 key购买 nike

我遇到了这个问题:

native 库 Ltkrnx.dll 已加载到另一个类加载器中

在重新部署应用程序期间(tomcat 8 服务器)。

我还添加了检查,但这对我没有帮助。

private void loadLibrary(LTLibrary library) {
if (!Platform.isLibraryLoaded(library)) {
Platform.loadLibrary(library);
}
}

由以下原因引起:leadtools.RasterException: native 库 C:\LEADTOOLS 20\Bin\CDLL\x64\Ltkrnx.dll 已在另一个类加载器中加载

最佳答案

您是否在 2 个不同的 Web 应用程序中使用 LEADTOOLS?如果是,以下答案可能会帮助您解决问题: java.lang.UnsatisfiedLinkError: Native Library XXX.so already loaded in another classloader

由于该问题是关于 OpenCV,而不是 LEADTOOLS,因此我将在这里引用相关部分(稍作编辑):

Now there's the restriction that a native library can only be loaded in one class loader. Web applications use their own class loader so if one web application has loaded a native library, another web application cannot do the same. Therefore code loading native libraries cannot be put in a webapp directory but must be put in the container's (Tomcat) shared directory. When you have a class written with the usual pattern above (loadLibrary in static initializer of using class) it's enough to put the jar containing the class in the shared directory. With .. the loadLibrary call in the web application code however, the native library will still be loaded in the "wrong" class loader and you will get the UnsatisfiedLinkError.

To make the "right" class loader load the native library you could create a tiny class with a single static method doing only the loadLibrary. Put this class in an extra jar and put this jar in the shared Tomcat directory. Then in the web applications replace the call to System.loadLibrary with a call to your new static method. This way the class loaders for the .. native library will match and the native methods can be initialized.

如果您的情况不同,或者那里的建议对您没有帮助,请将以下信息发送至 support@leadtools.com,我们的支持团队将与您一起找出问题:

  1. 此问题的详细信息(您遇到的异常(exception)情况,LEADTOOLS 版本 20,64 位,Tomcat 8)
  2. 您的 LEADTOOLS 产品序列号(请勿将其发布在此处!)。如果您仍在评估并且没有序列号,只需提及即可。
  3. 到目前为止,您已尝试过哪些方法来解决该问题以及得到了什么结果(例如上面提到的答案)。
  4. 有关您的操作系统、IDE 或一般编程环境的其他详细信息。

关于java - Leadtools.RasterException : Native Library Ltkrnx. dll 已加载到另一个类加载器中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56151457/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com