Exception in VOCE sample C++ app - java

I've been playing around with the C++ api of Voce for speech recognition in one of my projects. So far, I've been able to compile the C++ version of one of the sample apps provided by Voce named recognitionTest (provided under the samples directory in voce-0.9.1).
However, when I try running recognitionTest.exe, I hit an IndexOutOfBoundsException (console output is provided below).
[Voce] Java virtual machine created
[Voce] Initializing recognizer. This may take some time...
[Voce] Initialization complete
This is a speech recognition test. Speak digits from 0-9 into the microphone. Speak 'quit' to quit.
Exception in thread "Recognition thread" java.lang.IndexOutOfBoundsException: Index: 110,Size: 109
at java.util.SubList.rangeCheck(Unknown Source)
at java.util.SubList.get(Unknown Source)
at edu.cmu.sphinx.decoder.scorer.ScoreableJob.getFirst(ThreadedAcousticScorer.java:516)
at edu.cmu.sphinx.decoder.scorer.ThreadedAcousticScorer.scoreScoreables(ThreadedAcousticScorer.java:310)
at edu.cmu.sphinx.decoder.scorer.ThreadedAcousticScorer.calculateScores(ThreadedAcousticScorer.java:276)
at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.scoreTokens(SimpleBreadthFirstSearchManager.java:337)
at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.recognize(SimpleBreadthFirstSearchManager.java:258)
at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.recognize(SimpleBreadthFirstSearchManager.java:226)
at edu.cmu.sphinx.decoder.Decoder.decode(Decoder.java:94)
at edu.cmu.sphinx.recognizer.Recognizer.recognize(Recognizer.java:116)
at edu.cmu.sphinx.recognizer.Recognizer.recognize(Recognizer.java:135)
at voce.SpeechRecognizer.run(SpeechRecognizer.java:129)
at java.lang.Thread.run(Unknown Source)
I'm using Windows 8 and 32-bit version of java 1.5.
Question: Has someone encountered a similar error before? The exception seems to be thrown by the underlying cmusphinx library. So, I'm unable to debug the issue.
Any help would be greatly appreciated!
Please let me know if any additional info would be helpful in figuring out the issue.
Thanks in advance!

Related

Getting "Could not initialize class sun.security.ec.SunEC" How to Proceed?

After coming back to a part of my code base that hadn't been touched for a few weeks, I got the rather terse message: "Could not initialize class sun.security.ec.SunEC" from my functional REST test cases.
I'm not making much progress figuring out how tackle this one, there's no other error information (no stack trace) and not much on the Internet. I expect an update has changed something since everything was working.
Does anyone have any suggestions or insight for fixing this one?
Ubuntu 16.10
Java 8, Oracle, "1.8.0_131"
The problem was caused by a missing library libsunec.so. I was using the alpine docker container V3.4 which contained the library, but when I upgraded to V3.5, a "glich" in my build process actually had me still using V3.4. When that was indirectly "fixed," and I unknowingly started using V3.5, the error was suddenly, and confusingly, uncovered because libsunec.so was left out of alpine V3.5. See: https://bugs.alpinelinux.org/issues/6809

haarcascade_frontalface_alt.xml not working

I am currently working on a java project on face detection. I am using OpenCV API opencv_310 available at the official site and started writing the program following
this tutorial
But the main problem is that this tutorial was written more than five years ago. So the OpenCV APIs and working procedures have changed over the years. So I encountered a problem regarding the file haarcascade_frontalface_alt.xml.
new CvHaarClassifierCascade(cvLoad(FACE_CASCADE_PATH));
This line of code throws the following exception:
OpenCV Error: Unspecified error (The node does not represent a user object (unknown type?)) in cvRead, file ........\opencv\modules\core\src\persistence.cpp, line 4991
Exception in thread "main" java.lang.RuntimeException: ........\opencv\modules\core\src\persistence.cpp:4991: error: (-2) The node does not represent a user object (unknown type?) in function cvRead
So I browsed the Internet for a while and found this. It says the old C API does not support the newer haarcascade format. It also suggests to try with the C++ API.
What should I do now? I don't know how to try the C++ API. It will be highly appreciable if you can give some instructions on how to deal with the problem.
Thanks.
Try checking this tutorial which is from opencv site. This has a link to the source code. The xml file which you have trouble is the trained data.. if you would like to just download this file, you can find it here
regards

Spontaneous NullPointerExceptions when firing Events

I'm currently making a JavaFX Level Editor in combination with the LWJGL library in order to implement OpenGL capabilities, and thus, using multi-threading.
My problem however, is that sometimes when I fire JavaFX events (when I press a button / key etc.) I get this spontaneous java.lang.NullPointerException. I can't seem to figure out the pattern of when exactly the error occurs, and for some strange reason the stacktrace won't provide me with where the exception occurred. All I know is that it occurs when I in some way interact with the JavaFX Application Thread.
When it does occur however, it does not only print it to the console once and then crash. What happens is that the application continuously prints out the the error message over and over again until I force-close the application. It seems like I can no longer fire some specific events when the error has occurred.
This is the spontaneous repeated error message that I get:
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at javafx.scene.Scene$ScenePulseListener.synchronizeSceneNodes(Unknown Source)
at javafx.scene.Scene$ScenePulseListener.pulse(Unknown Source)
at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Unknown Source)
at com.sun.javafx.tk.Toolkit$$Lambda$153/452428720.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.Toolkit.runPulse(Unknown Source)
at com.sun.javafx.tk.Toolkit.firePulse(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$400(Unknown Source)
at com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$42/424424770.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$145(Unknown Source)
at com.sun.glass.ui.win.WinApplication$$Lambda$38/12064136.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I guess that it has something to do with "synchronizing nodes". Since I'm working with multithreading in order to run a render-loop with OpenGL this might have something to do with the case. I am also using Lambda Expression from Java8, and apparently as it says in the error log it has something to do with them too.
I am not expecting someone to give me an exact answer to what my problem is, and what I've done wrong, since I do not provide any code (because my project is too big and I do not know where the Exception occurs).
However, I have a few generic questions:
What does this error log mean?
What might cause this?
Why does it not provide me with any information of where the Exception occurred?
I managed to get the line numbers from the stacktrace by switching JRE in Eclipse from the JRE installation to the jar provided by the JDK. This allowed me to get line numbers from the compiled APIs, such at JavaFX itself.
This is the new error log:
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at javafx.scene.Scene$ScenePulseListener.synchronizeSceneNodes(Scene.java:2289)
at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2419)
at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:314)
at com.sun.javafx.tk.Toolkit$$Lambda$153/478814140.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:313)
at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:340)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:525)
at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:505)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$400(QuantumToolkit.java:334)
at com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$42/1940618951.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$145(WinApplication.java:101)
at com.sun.glass.ui.win.WinApplication$$Lambda$38/640174177.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
My error lies within the JavaFX classes and probably somewhere within my lambda expression, since the only place where it still says (Unknown Source) is where it also says "lambda". Maybe the stacktrace can't show line numbers in lambdas?
Anyway, this is the line of code that returns a NullPointerException:
if (node.getScene() == Scene.this)
This is within the JavaFX Scene class
Not an answer, only suggestion from troubleshooting a very similar problem - a Swing one.
To avoid any guessing, we should look at the source code - resolve the "unknown source" part.
The stacktrace you provided is lacking line numbers.
This is because, the standard JRE is compiled without any debug information.
Once, I believe at Sun times, one could download a separate distribution aimed at developers with all debugging symbols in place.
That allowed, besides having the exact line numbers, also to set up breakpoints inside the JDK's code.
We could start investigating issues right from there.
If there is no JRE with debug symbols, You can always try compiling your own!
I've once successfully compiled the "src.zip" file, which accompanied the JDK distribution. It wasn't self contained though! There were several parts missing, some Linux specific classes etc. The javac from JDK itself had problems with the file - it ran out of memory all the time. Fortunately, the Eclipse's javac compiler can deal with big codebase and partially compile classes.
Then, I ran my program with the resulting jar (the src.zip compiled with debug symbols) at the bootstrap classpath. Normally, you aren't allowed to modify anything inside "java." and "sun." packages. With bootstrap classpath, you can.
Now, back to Your certain problem: both JavaFX and OpenGL solve multithreading issues, by so called "thread confinement". That means, that everything is forcefully single-threaded. Probably, Your issues arises from the fact, that both javaFx and OpenGL has their separate threads! I'm betting, you did some interaction outside of the JavaFX's EDT. But, it's only a far fetched hypothesis. Try getting the source lines, we could go on from there.
At the time I needed the debug info, I was following the answer from here: debug jdk source can't watch variable what it is
But, all the work might not be needed! I just learned, You could attach the source files itself to the boot classpath, as specified here: https://stackoverflow.com/a/10498425
Update,
So, it seems the "node" reference is null (I doubt that "this" is null).
Next step would identifying the null node and find the exact time where it was added. I'd probably put some breakpoints (or printout statements) at all sensible "addNode" invocations - from your program.
From the source code (I quickly skimmed through http://grepcode.com/file/repo1.maven.org/maven2/net.java.openjfx.backport/openjfx-78-backport/1.8.0-ea-b96.1/javafx/scene/Scene.java#2263 ) it seems, the "null" reference comes from the "dirtyNodes" array".
My best bet normally would be, that you're indirectly calling invoking the addToDirtyNodes ( http://grepcode.com/file/repo1.maven.org/maven2/net.java.openjfx.backport/openjfx-78-backport/1.8.0-ea-b96.1/javafx/scene/Scene.java#503 ) from outside the proper Thread. To my surprise, there is a first line which checks if it's called from the proper one:
Toolkit.getToolkit().checkFxUserThread();
Do You happen to see the line "Not on FX application thread; currentThread = " in your program's output?
Let's just hope, it's not a bug in JavaFX itself.
Don't modify your GUI on a non-GUI thread.
As I don't see your code I'm not sure where exactly you do it, but I had the same issue and it turns out I had passed a GUI object to a class of mine that ran a method on a non-GUI thread that was updating a GUI object. So don't do that.
As said, we also had this problem. It seems to have been caused by updating the UI from within a javafx.concurrent.Service's Task's call() method, although the updates were performed from a lambda handed over to Platform.runLater().
So I moved the UI update code from there to the Service's On-Succeeded/Failed-Handlers where it should have been in the first place. That seems to have eliminated the issue for us.
There are two JDK Bug entries related to this:
https://bugs.openjdk.java.net/browse/JDK-8095034
https://bugs.openjdk.java.net/browse/JDK-8098064
Any JDK version before 8u20 may be affected by this problem.

null pointer exception when programming for android phone from processing IDE

i am relatively new to java programming and programming for android and have been experimenting with android bluetooth comms using the Ketai library for the processing IDE specifically for use with android and tried to run the example program bluetoothcursors.pde that comes with the library but i keep getting the "application has stopped unexpectedly" error and the console indicates a null pointer exception error. The actual output is below:
FATAL EXCEPTION: Animation Thread
java.lang.NullPointerException
at ketai.net.bluetooth.KBluetoothListener.<init>(KBluetoothListener.java:56)
at ketai.net.bluetooth.KetaiBluetooth.start(KetaiBluetooth.java:207)
at processing.test.bluetoothcursors.BluetoothCursors.setup(BluetoothCursors.java:80)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:1019)
However i cant seem to see where the null pointer exception is coming from. I assume the null pointer exception relates to a variable that has not been instantiated properly. I have tried a process of elimination to try and isolate the cause but i get the same error but with slightly different source. I have also posted this question on the processing forum but have not received a reply. I just assumed that since it was part of the examples for the library it would work so maybe the error is being created somewhere else. I have tried other library examples and theses all work fine so i dont think its my setup. I also have other bluetooth programs working on android from processing but these use pure java code and are harder to follow.
I have had a look at some of the similar questions which have been sort-of helpful but i am still stuck.
I have set the correct bluetooth etc permissions and am using android version 2.3.3 and processing version 2.0.
Any help with this is much appreciated.
Cheers.

java.nio.channels.OverlappingFileLockException occurring randomly when attempting to embed applet?

Has anyone ever seen this odd error when attempting to load an applet? I get this in jconsole, although the applet activity is pretty plain. I get this exception after
java.lang.NullPointerException
at sun.plugin.AppletViewer.loadJarFiles(Unknown Source)
It's a 1.6.13 issue. It was a JRE bug.

Categories