x)- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
java -d64 -cp ./target/SpeechSDKDemo-0.0.1-SNAPSHOT.jar:./target/dependency/client-sdk-1.0.0.jar com.microsoft.cognitiveservices.speech.samples.console.Main
Choose option 5: "Speech recognition with audio stream"
Exception in thread "main" java.lang.NoClassDefFoundError: com/microsoft/cognitiveservices/speech/RecognitionResult
at com.microsoft.cognitiveservices.speech.samples.console.Main.main(Main.java:47)
Caused by: java.lang.ClassNotFoundException: com.microsoft.cognitiveservices.speech.RecognitionResult
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
I get the transcription of my audio file
Linux:
```$ uname -a
Linux mypc 4.18.6-arch1-1-ARCH #1 SMP PREEMPT Wed Sep 5 11:54:09 UTC 2018 x86_64 GNU/Linux
### Versions
$ java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
```
I'm using the current latest version from this repo 703d4b0111f4b61f09d776295bd1c5aff7674df5.
I've seen issue #46 but I don't think that applies here because I'm running a 64 bit JVM.
I'm tried this in an Ubuntu Docker container (following the installation steps from the README) and also in an Ubutu 16.04 VM (using the same installation steps).
hI Andrew,
I am wondering how how generated the jar files. Especially the client-sdk jar contains a set of binary resources that implement the native layer of our libraries and a class not found exception is a symptom that they could not be loaded.
In your particular case, this does not seem to apply as the RecognitionResult is not triggering the load of the binary libaries.
I would therefore rather assume that either
The classpath in your repro steps above is not pointing to the Speech SDK jar file.
or
the jar file is not Speech SDK 1.0.0 (please note that we made breaking changes in version 1.0.0 so any other library will not work with the latest samples)
In either case, could you please follow the sample steps (using eclipse and maven) to see if your problem persists? thanks a lot!
Here is the link to the instructions
https://github.com/Azure-Samples/cognitive-services-speech-sdk/tree/master/samples/java/jre/console
kind regards,
friedel
Hi,
I built the JAR using mvn package and got the client-sdk dependency by running mvn install dependency:copy-dependencies which just copies the JAR from ~/.m2/repository.
I'll investigate further using Eclipse as you suggested.
Hi again,
I installed Eclipse and ran the project in the way that is described in the docs and everything worked as it should.
I'm not going to package Eclipse in a production application, so I continued to investigate. To my surprise when I ran the project from the original directory everything still worked correctly. I then uninstalled Eclipse (and deps), and the app was still fine.
If I create a Docker container that just has the required JARs it still doesn't work.
cd cognitive-services-speech-sdk/samples/java/jre/console
mvn clean package
mvn install dependency:copy-dependencies
docker build -t console .
If at this point I run java -d64 -cp ./target/SpeechSDKDemo-0.0.1-SNAPSHOT.jar:./target/dependency/client-sdk-1.0.0.jar com.microsoft.cognitiveservices.speech.samples.console.Main everything is fine.
However docker run --rm console gives:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no Microsoft.CognitiveServices.Speech.java.bindings in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at com.microsoft.cognitiveservices.speech.SpeechConfig.<clinit>(SpeechConfig.java:44)
at com.microsoft.cognitiveservices.speech.samples.console.SpeechRecognitionSamples.continuousRecognitionWithFileAsync(SpeechRecogniti
onSamples.java:154)
at com.microsoft.cognitiveservices.speech.samples.console.Main.main(Main.java:44)
I get a similar issue with my Ubuntu VM.
Both the Docker container and the Ubuntu VM are headless, so for one final test I created a new Ubuntu 16.04 VM but with a running X.
I copied over the JARs from above and they didn't work in the usual manner. However, after installing Eclipse I could build and run the program successfully from Eclipse.
Most interestingly though: I could run the JARs that I had copied over that hadn't been touched. It appears that running Eclipse causes the programs to work. I'm stumped regarding the cause.
@ahjones - can you double-check you've got the packages that are listed here installed?
closing this, since there was no update in the last three weeks
Most helpful comment
@ahjones - can you double-check you've got the packages that are listed here installed?