I have a Java class that calls a C++ function (JNI) and the return of that function is a Java object:
There�s the problematic C++ code:
jclass taskDescriptorClass = env->FindClass("a/b/TaskDescriptor");
if (taskDescriptorClass == NULL) {
//Class cannot be found
return NULL;
}
jmethodID constructorMID = env->GetMethodID(taskDescriptorClass, "<init>", "void(V)");
if (constructorMID == NULL) {
return NULL;
}
This code as always behaved as expected, running in a JUnit test. But now I�m calling the code inside a thread (new Thread(new Runnable() { public void run() { ...NATIVE CALL...), but now I�m getting an exception:
Exception in thread "thrd1" java.lang.NoSuchMethodError: <init>
at a.b.JTLs.createTask(Native Method)
at a.b.GrammarBuilder.build(GrammarBuilder.java:216)
at a.b.GrammarManager.getModel(GrammarManager.java:230)
at a.b.GrammarManager.getModel(GrammarManager.java:146)
at a.b.TestGrammarManager$1.run(TestGrammarManager.java:58)
at java.lang.Thread.run(Thread.java:595)
I�m using J2SE 5 update 06
Does anyone know why is this happening?
Thanks