Java JBoss致命错误:找不到所需的名为JLinkNativeLibrary的本机库 [英] Java JBoss Fatal error: cannot find the required native library named JLinkNativeLibrary

查看:90
本文介绍了Java JBoss致命错误:找不到所需的名为JLinkNativeLibrary的本机库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用JBoss与Java Web Application中的Wolfram Mathematica内核一起工作.

I'm trying to work with Wolfram Mathematica Kernel from Java Web Application using JBoss.

这是一个主要班级.

public class Main {

 static KernelLink ml;
 static KernelLink ml2;

 public Main(){
    String path = "-linkmode launch -linkname 'C:/Program Files/Wolfram Research/Mathematica/9.0/MathKernel.exe'";
    try {

        ml = MathLinkFactory.createKernelLink(path);// подключаем ядро
        ml.setComplexClass(MyComplex.class);

        System.out.println(ml.getComplexClass());
        ml.discardAnswer();
        ml.evaluate("<<hexagon.m");
        ml.discardAnswer();


    }
    catch (Exception e){
        System.out.println(e.toString());
    }
}
}

当我在Servlet中初始化Main Object时,出现错误.

When I initialize Main Object in Servlet I get an error.

21:30:59,520 ERROR [stderr] (http-/127.0.0.1:8080-2) Fatal error: cannot find the required native library named JLinkNativeLibrary.
21:30:59,520 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/WEbTest_war_exploded].[jsp]] (http-/127.0.0.1:8080-2)  JBWEB000236: Servlet.service() for servlet jsp threw exception:  java.lang.UnsatisfiedLinkError:   com.wolfram.jlink.NativeLink.MLOpenString(Ljava/lang/String;[Ljava/lang/String;)J
at com.wolfram.jlink.NativeLink.MLOpenString(Native Method) [JLink.jar:4.4.0 January 24 2013]
at com.wolfram.jlink.NativeLink.<init>(NativeLink.java:117) [JLink.jar:4.4.0 January 24 2013]
at com.wolfram.jlink.MathLinkFactory.createMathLink0(MathLinkFactory.java:281) [JLink.jar:4.4.0 January 24 2013]
at com.wolfram.jlink.MathLinkFactory.createMathLink(MathLinkFactory.java:194) [JLink.jar:4.4.0 January 24 2013]
at com.wolfram.jlink.MathLinkFactory.createKernelLink0(MathLinkFactory.java:171) [JLink.jar:4.4.0 January 24 2013]
at com.wolfram.jlink.MathLinkFactory.createKernelLink(MathLinkFactory.java:65) [JLink.jar:4.4.0 January 24 2013]
at kostya.Main.<init>(Main.java:21)

推荐答案

该错误表示加载本机库时出现问题. Java具有用于加载本机库的协议,本机库是Windows中的.DLL文件.很有可能它是使用字符串中的显式路径启动应用程序,然后无法加载某些DLL与之通信.

The error indicates a problem with loading a native library. Java has a protocol for loading native libraries, which are .DLL files in Windows. Most likely it is starting the application using the explicit path in the string and then failing to load some DLL to communicate with it.

确保Java可以看到带有DLL的目录(尝试将其添加到系统PATH并首先重新启动服务器): https://www.chilkatsoft.com/java-loadLibrary-Windows.asp

Make sure the directory with DLLs can be seen by Java (try adding it to the system PATH and restarting the server first): https://www.chilkatsoft.com/java-loadLibrary-Windows.asp

这篇关于Java JBoss致命错误:找不到所需的名为JLinkNativeLibrary的本机库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆