I use Java Matlab Engine API on Linux, no mwnativejava_engine_core in java.library.path
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am using the Java Matlab Engine API on Linux and the following error is reported. Is it because the installation is incorrect or something? I cannot find the file in the runtime package. I installed runtime 2022b,Is there also a problem with what I installed, The error log is as follows:
JDK:1.8
MatLab Runtime :R2022b
test_1 | Caused by: java.lang.UnsatisfiedLinkError: no mwnativejava_engine_core in java.library.path
test_1 | at com.test.analysis.util.MatLabEngine.<clinit>(MatLabEngine.java:31) ~[classes!/:1.0.0-SNAPSHOT]
MatLabEngine.java
31 MatlabEngine eng = MatlabEngine.startMatlab();
test_1 | 2024-08-14 01:22:30.634 INFO 1 --- [ main] com.test.analysis.util.MatLabEngine : Prepare to start the MATLAB engine.
test_1 | java.library.path:/usr/local/MATLAB/MATLAB_Runtime/R2022b/bin/glnxa64
test_1 | 2024-08-14 01:22:30.709 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'matLabEngine' defined in URL [jar:file:/app.jar!/BOOT-INF/classes!/com/test/analysis/util/MatLabEngine.class]: Instantiation of bean failed; nested exception is java.lang.UnsatisfiedLinkError: no mwnativejava_engine_core in java.library.path
test_1 | 2024-08-14 01:22:30.804 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
test_1 | 2024-08-14 01:22:31.872 INFO 1 --- [ main] ConditionEvaluationReportLoggingListener :
test_1 |
test_1 | Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
test_1 | 2024-08-14 01:22:32.197 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed
test_1 |
test_1 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'matLabEngine' defined in URL [jar:file:/app.jar!/BOOT-INF/classes!/com/test/analysis/util/MatLabEngine.class]: Instantiation of bean failed; nested exception is java.lang.UnsatisfiedLinkError: no mwnativejava_engine_core in java.library.path
test_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1334) ~[spring-beans-5.3.23.jar!/:5.3.23]
test_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1232) ~[spring-beans-5.3.23.jar!/:5.3.23]
test_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.23.jar!/:5.3.23]
test_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.23.jar!/:5.3.23]
test_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.23.jar!/:5.3.23]
test_1 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.23.jar!/:5.3.23]
test_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.23.jar!/:5.3.23]
test_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.23.jar!/:5.3.23]
test_1 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) ~[spring-beans-5.3.23.jar!/:5.3.23]
test_1 | at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.23.jar!/:5.3.23]
test_1 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.23.jar!/:5.3.23]
test_1 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.13.jar!/:2.6.13]
test_1 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:745) [spring-boot-2.6.13.jar!/:2.6.13]
test_1 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:420) [spring-boot-2.6.13.jar!/:2.6.13]
test_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-2.6.13.jar!/:2.6.13]
test_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1317) [spring-boot-2.6.13.jar!/:2.6.13]
test_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) [spring-boot-2.6.13.jar!/:2.6.13]
test_1 | at com.test.analysis.MicroseismApplication.main(MicroseismApplication.java:33) [classes!/:1.0.0-SNAPSHOT]
test_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_152]
test_1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_152]
test_1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_152]
test_1 | at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_152]
test_1 | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [app.jar:1.0.0-SNAPSHOT]
test_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) [app.jar:1.0.0-SNAPSHOT]
test_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [app.jar:1.0.0-SNAPSHOT]
test_1 | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [app.jar:1.0.0-SNAPSHOT]
test_1 | Caused by: java.lang.UnsatisfiedLinkError: no mwnativejava_engine_core in java.library.path
test_1 | at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867) ~[na:1.8.0_152]
test_1 | at java.lang.Runtime.loadLibrary0(Runtime.java:870) ~[na:1.8.0_152]
test_1 | at java.lang.System.loadLibrary(System.java:1122) ~[na:1.8.0_152]
test_1 | at com.mathworks.javaenginecore.JavaEngineFeval.<clinit>(JavaEngineFeval.java:18) ~[engine-1.0.jar!/:na]
test_1 | at com.mathworks.engine.MatlabEngine.open(MatlabEngine.java:359) ~[engine-1.0.jar!/:na]
test_1 | at com.mathworks.engine.MatlabEngine.startMatlab(MatlabEngine.java:141) ~[engine-1.0.jar!/:na]
test_1 | at com.test.analysis.util.MatLabEngine.<clinit>(MatLabEngine.java:31) ~[classes!/:1.0.0-SNAPSHOT]
test_1 | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_152]
test_1 | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_152]
test_1 | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_152]
test_1 | at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_152]
test_1 | at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211) ~[spring-beans-5.3.23.jar!/:5.3.23]
test_1 | at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.3.23.jar!/:5.3.23]
test_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1326) ~[spring-beans-5.3.23.jar!/:5.3.23]
test_1 | ... 25 common frames omitted
test_1 |
root@ubuntu:/matlab# ^C
root@ubuntu:/matlab# uname -a
Linux ubuntu 5.4.0-150-generic #167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
root@ubuntu:/matlab#
0 Kommentare
Antworten (1)
Prasanna
am 17 Aug. 2024
Hi w,
It is my understanding that you are getting an ‘unsatisfiedLinkError’ while using the Java MATLAB Engine API on Linux. The error indicates that the MATLAB Engine API for Java is unable to find the native library ‘mwnative_engine_core’. This issue may be due to an incorrect configuration of the MATLAB runtime.
To resolve the same, check if the MATLAB runtime is installed correctly and the files are present in the corresponding directory. Then, set the ‘java.library.path’ variable to include the directory where the libraries are located.
For more information regarding the following, refer the following: https://www.mathworks.com/matlabcentral/answers/320234-using-java-api-gives-no-nativemvm-in-java-library-path
Hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!