My application is a spring boot java project connecting to the azure services for converting speech to text, analyzing sentiment and translating. I am trying to deploy my application to a centos 7 VM, but I get the error in the title when calling my endpoint converting speech to text. I have no problem running the application from my local windows 10 machine. Here are my logs:
:: Spring Boot :: (v2.5.2)
2022-04-08 13:35:27.482 INFO 30261 --- [ main] .e.t.f.m.ExtractTextFromMediaApplication : Starting ExtractTextFromMediaApplication v0.0.1-SNAPSHOT using Java 11.0.14.1 on speech2text..net with PID 30261 (/usr/local/speech2text/extractTextFromMedia-0.0.1-SNAPSHOT.jar started by root in /export/home/fos)
2022-04-08 13:35:27.497 INFO 30261 --- [ main] .e.t.f.m.ExtractTextFromMediaApplication : No active profile set, falling back to default profiles: default
2022-04-08 13:35:29.701 INFO 30261 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8443 (https) 8080 (http)
2022-04-08 13:35:29.724 INFO 30261 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-04-08 13:35:29.725 INFO 30261 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.48]
2022-04-08 13:35:29.792 INFO 30261 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-04-08 13:35:29.792 INFO 30261 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2186 ms
2022-04-08 13:35:30.925 INFO 30261 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint(s) beneath base path '/actuator'
2022-04-08 13:35:31.336 INFO 30261 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8443 (https) 8080 (http) with context path ''
2022-04-08 13:35:31.363 INFO 30261 --- [ main] .e.t.f.m.ExtractTextFromMediaApplication : Started ExtractTextFromMediaApplication in 4.656 seconds (JVM running for 5.295)
2022-04-08 13:35:36.283 INFO 30261 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-04-08 13:35:36.284 INFO 30261 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2022-04-08 13:35:36.285 INFO 30261 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
2022-04-08 13:35:36.821 INFO 30261 --- [nio-8080-exec-1] c.r.c.e.t.f.m.s.TextFromMediaService : 20220408133536_videoplayback.mp4 video file was coppied on disk.
2022-04-08 13:35:36.995 INFO 30261 --- [nio-8080-exec-1] c.r.c.e.t.f.m.s.TextFromMediaService : Audio file created in path: /tmp/temp_audio/20220408133536_videoplayback_20220408133536.wav
2022-04-08 13:35:37.077 ERROR 30261 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.UnsatisfiedLinkError: 'void com.microsoft.cognitiveservices.speech.SpeechConfig.setTempDirectory(java.lang.String)'] with root cause
java.lang.UnsatisfiedLinkError: 'void com.microsoft.cognitiveservices.speech.SpeechConfig.setTempDirectory(java.lang.String)'
at com.microsoft.cognitiveservices.speech.SpeechConfig.setTempDirectory(Native Method) ~[client-sdk-1.19.0.jar!/:na]
at com.microsoft.cognitiveservices.speech.SpeechConfig.<clinit>(SpeechConfig.java:77) ~[client-sdk-1.19.0.jar!/:na]
at com...extract.text.from.media.service.ExtractTextFromAudioService.getSpeechConfig(ExtractTextFromAudioService.java:102) ~[classes!/:0.0.1-SNAPSHOT]
at com...extract.text.from.media.service.ExtractTextFromAudioService.continuousRecognitionWithFileWithPhraseListAsync(ExtractTextFromAudioService.java:32) ~[classes!/:0.0.1-SNAPSHOT]
at com...extract.text.from.media.service.TextFromMediaService.getTextFromMediaFile(TextFromMediaService.java:89) ~[classes!/:0.0.1-SNAPSHOT]
at com...extract.text.from.media.service.TextFromMediaService.getTextFromMedia(TextFromMediaService.java:72) ~[classes!/:0.0.1-SNAPSHOT]
at com...extract.text.from.media.controller.MediaToTextMultipartController.extractTextFromMedia(MediaToTextMultipartController.java:28) ~[classes!/:0.0.1-SNAPSHOT]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[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:566) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) ~[spring-web-5.3.8.jar!/:5.3.8]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) ~[spring-web-5.3.8.jar!/:5.3.8]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.3.8.jar!/:5.3.8]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) ~[spring-webmvc-5.3.8.jar!/:5.3.8]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.8.jar!/:5.3.8]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.8.jar!/:5.3.8]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1063) ~[spring-webmvc-5.3.8.jar!/:5.3.8]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.8.jar!/:5.3.8]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.8.jar!/:5.3.8]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.3.8.jar!/:5.3.8]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:681) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.8.jar!/:5.3.8]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:228) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.48.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.8.jar!/:5.3.8]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.8.jar!/:5.3.8]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.8.jar!/:5.3.8]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.8.jar!/:5.3.8]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96) ~[spring-boot-actuator-2.5.2.jar!/:2.5.2]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.8.jar!/:5.3.8]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.8.jar!/:5.3.8]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.8.jar!/:5.3.8]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1723) ~[tomcat-embed-core-9.0.48.jar!/:na]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.48.jar!/:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.48.jar!/:na]
at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]
This is my pom file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=http://maven.apache.org/POM/4.0.0
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.2</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com..</groupId>
<artifactId>extractTextFromMedia</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>extractTextFromMedia</name>
<description>Project for extracting the text from media files</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- video to audio -->
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-all-deps</artifactId>
<version>3.2.0</version>
</dependency>
<!-- azure -->
<dependency>
<groupId>com.microsoft.cognitiveservices.speech</groupId>
<artifactId>client-sdk</artifactId>
<version>1.20.0</version>
</dependency>
<!-- sentiment analysis -->
<!-- https://mvnrepository.com/artifact/com.azure/azure-ai-textanalytics -->
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-ai-textanalytics</artifactId>
<version>5.1.7</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>
<repositories>
<repository>
<id>maven-cognitiveservices-speech</id>
<name>Microsoft Cognitive Services Speech Maven Repository</name>
<url>https://csspeechstorage.blob.core.windows.net/maven/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<requiresUnpack>
<dependency>
<groupId>com.microsoft.cognitiveservices.speech</groupId>
<artifactId>client-sdk</artifactId>
<version>1.20.0</version>
</dependency>
</requiresUnpack>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
I run my program by building it into a fat .jar file with mvn clean package, transfer the jar to my VM and run it through a service there (with java -jar).
I have installed the packages indicated here: https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/how-to-configure-rhel-centos-7 Althrough, I don't entirely understand how my environmental variable should look like there.
I have also tried transferring the whole project folder in the VM and running it there, but I get the same error. I am unsure what to try next.
I've opened a similar issue on github - https://github.com/Azure-Samples/cognitive-services-speech-sdk/issues/1461
L.E: I've managed to run the sample java program in the above github with no problems, so it seems like I have all the required dependencies on the machine. My spring project just doesn't use them for whatever reason.
LE2: find /usr/local/lib64 result:
/usr/local/lib64/
/usr/local/lib64/libstdc++fs.a
/usr/local/lib64/libstdc++.so.6.0.24
/usr/local/lib64/libstdc++.so.6
/usr/local/lib64/libstdc++.so
/usr/local/lib64/libstdc++.la
/usr/local/lib64/libstdc++.a
/usr/local/lib64/libstdc++.so.6.0.24-gdb.py
/usr/local/lib64/liblsan.so.0.0.0
/usr/local/lib64/liblsan.so.0
/usr/local/lib64/liblsan.so
/usr/local/lib64/liblsan.la
/usr/local/lib64/liblsan.a
/usr/local/lib64/libasan_preinit.o
/usr/local/lib64/libasan.so.4.0.0
/usr/local/lib64/libasan.so.4
/usr/local/lib64/libasan.so
/usr/local/lib64/libasan.la
/usr/local/lib64/libasan.a
/usr/local/lib64/libubsan.so.0.0.0
/usr/local/lib64/libubsan.so.0
/usr/local/lib64/libubsan.so
/usr/local/lib64/libubsan.la
/usr/local/lib64/libubsan.a
/usr/local/lib64/libtsan_preinit.o
/usr/local/lib64/libtsan.so.0.0.0
/usr/local/lib64/libtsan.so.0
/usr/local/lib64/libtsan.so
/usr/local/lib64/libtsan.la
/usr/local/lib64/libtsan.a
/usr/local/lib64/libsanitizer.spec
/usr/local/lib64/libmpx.so.2.0.1
/usr/local/lib64/libmpx.so.2
/usr/local/lib64/libmpx.so
/usr/local/lib64/libmpx.la
/usr/local/lib64/libmpx.a
/usr/local/lib64/libmpxwrappers.so.2.0.1
/usr/local/lib64/libmpxwrappers.so.2
/usr/local/lib64/libmpxwrappers.so
/usr/local/lib64/libmpxwrappers.la
/usr/local/lib64/libmpxwrappers.a
/usr/local/lib64/libmpx.spec
/usr/local/lib64/libcilkrts.spec
/usr/local/lib64/libcilkrts.so.5.0.0
/usr/local/lib64/libcilkrts.so.5
/usr/local/lib64/libcilkrts.so
/usr/local/lib64/libcilkrts.la
/usr/local/lib64/libcilkrts.a
/usr/local/lib64/libssp.so.0.0.0
/usr/local/lib64/libssp.so.0
/usr/local/lib64/libssp.so
/usr/local/lib64/libssp.la
/usr/local/lib64/libssp_nonshared.la
/usr/local/lib64/libssp.a
/usr/local/lib64/libssp_nonshared.a
/usr/local/lib64/libgcc_s.so.1
/usr/local/lib64/libgcc_s.so
/usr/local/lib64/libquadmath.so.0.0.0
/usr/local/lib64/libquadmath.so.0
/usr/local/lib64/libquadmath.so
/usr/local/lib64/libquadmath.la
/usr/local/lib64/libquadmath.a
/usr/local/lib64/libgomp.spec
/usr/local/lib64/libgomp.so.1.0.0
/usr/local/lib64/libgomp.so.1
/usr/local/lib64/libgomp.so
/usr/local/lib64/libgomp.la
/usr/local/lib64/libgomp.a
/usr/local/lib64/libitm.spec
/usr/local/lib64/libitm.so.1.0.0
/usr/local/lib64/libitm.so.1
/usr/local/lib64/libitm.so
/usr/local/lib64/libitm.la
/usr/local/lib64/libitm.a
/usr/local/lib64/libatomic.so.1.2.0
/usr/local/lib64/libatomic.so.1
/usr/local/lib64/libatomic.so
/usr/local/lib64/libatomic.la
/usr/local/lib64/libatomic.a
/usr/local/lib64/libMicrosoft.CognitiveServices.Speech.core.so
/usr/local/lib64/libMicrosoft.CognitiveServices.Speech.extension.audio.sys.so
/usr/local/lib64/libMicrosoft.CognitiveServices.Speech.extension.codec.so
/usr/local/lib64/libMicrosoft.CognitiveServices.Speech.extension.kws.so
/usr/local/lib64/libMicrosoft.CognitiveServices.Speech.extension.lu.so
/usr/local/lib64/libMicrosoft.CognitiveServices.Speech.extension.mas.so
/usr/local/lib64/libMicrosoft.CognitiveServices.Speech.java.bindings.so
/usr/local/lib64/libcc1.so.0.0.0
/usr/local/lib64/libcc1.so.0
/usr/local/lib64/libcc1.so
/usr/local/lib64/libcc1.la
/usr/local/lib64/libsupc++.la
/usr/local/lib64/libsupc++.a
/usr/local/lib64/libstdc++fs.la
I've transferred the files located in speechSDK.jar - /lib/centos7-x64 here as well. (I've tried including them separately in -Djava.library.path too)
LE3: This is the last iteration of the commands I used to try to get it to work:
sudo java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -Djava.io.tmpdir=/export/home/fos/tmpDir -Djava.library.path=/usr/local/speech2text/speechSDK-1.20/ASSETS/linux-x64:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib:/usr/local/lib64:/usr/local/speech2text/speechSDK-1.20/ASSETS/centos7-x64 -jar extract-text-from-media-0.0.1-SNAPSHOT.jar