'Issue :: Microsoft Cognitive Services :: client-sdk :: Azure

I am trying to use Azure cognitive services and trying to convert "Text To Speech". I am able to convert the Text to Speech successfully on my local machine. The issue only happens when I deploy my application to Azure cloud using "App Services". I am getting the following error/exception when my code tries to create SpeechConfig e.g; SpeechConfig config = SpeechConfig(mySubscriptionKey,service-region)

Exception: UnsatisfiedLinkError

I am using the following tech stack on Azure cloud: Spring Boot 2.6.7 Linux (Tomcat embedded container) used by Spring Boot. client-jar-sdk 1.14.0 (com.microsoft.cognitiveservices.speech)

I am NOT using any Container or Container Service like Kubernetes in this example. It is a simple webapp deployed to Azure using App Services.

Note 1: Please note that I have also tried to use Microsoft cognitive services client-sdk (1.21.0), but I am getting the same exception. I went on google and found that other people were facing the same issue, but there was no satisfactory answer given.

https://docs.microsoft.com/en-us/answers/questions/660957/text-speech-when-speechconfig-init-got-error.html

Note 2: Please note that I am NOT using a free subscription and the resource group region is eastus.

Note 3: I have tried and deployed many code examples (for the Text to Speech) provided my Microsoft and other people on the internet but I am getting the same issue in the Azure Platform ONLY.

Exception Snapshot: The following is the exception snapshot

Exception Details: 2022-05-14T18:17:32.734458231Z 2022-05-14 18:17:32.733 ERROR 164 --- [p-nio-80-exec-7] 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: 'long com.microsoft.cognitiveservices.speech.SpeechConfig.fromSubscription(com.microsoft.cognitiveservices.speech.util.IntRef, java.lang.String, java.lang.String)'] with root cause 2022-05-14T18:17:32.734496431Z 2022-05-14T18:17:32.734502131Z java.lang.UnsatisfiedLinkError: 'long com.microsoft.cognitiveservices.speech.SpeechConfig.fromSubscription(com.microsoft.cognitiveservices.speech.util.IntRef, java.lang.String, java.lang.String)' 2022-05-14T18:17:32.734506931Z at com.microsoft.cognitiveservices.speech.SpeechConfig.fromSubscription(Native Method) ~[client-jar-sdk-1.14.0.jar!/:na] 2022-05-14T18:17:32.734511832Z at com.microsoft.cognitiveservices.speech.SpeechConfig.fromSubscription(SpeechConfig.java:103) ~[client-jar-sdk-1.14.0.jar!/:na] 2022-05-14T18:17:32.734516232Z at com.namepronunciation.service.AzureTextToSpeechHelper.callAzureToTransformTextToSpeech(AzureTextToSpeechHelper.java:24) ~[classes!/:0.0.1-SNAPSHOT] 2022-05-14T18:17:32.734520732Z at com.namepronunciation.service.NamePronunciationService.pronunce(NamePronunciationService.java:28) ~[classes!/:0.0.1-SNAPSHOT] 2022-05-14T18:17:32.734524832Z at com.namepronunciation.controller.NamePronunciationController.pronunce(NamePronunciationController.java:81) ~[classes!/:0.0.1-SNAPSHOT] 2022-05-14T18:17:32.734529232Z at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] 2022-05-14T18:17:32.734533332Z at

Thanks! Mansoor



Solution 1:[1]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SuryasriKamini-MT