I am using Java 1.6 on solaris and I am calling a method of a java class from a c program. As part of JNI procedure to call this java method, I sometimes get NoSuchMethodError thrown by Jni's GetMethodID which I will be calling before CallVoidMethodV. Strange thing is , I don't get this error every time. My program frequently invokes a java method from c program based on some events and at certain times I get this error. Any input on this problem will be really helpful.
As one guess, a C memory bug.
Such bugs can cause almost any sort of behavior. If you see crashes then that would insure it. But it could occur because the memory bug represents deterministic behavior so it only occurs when a specific execution path is taken.
Of course there could be some other context, for example if you are using class loaders and relying on different versions of code then it could be getting the older version.