I have a main method in a VC++ class, in which i am creating\instantiating JVM.
In main method i am calling a method of my own utility class to create JVM.
I am cacheing JVM pointer in a private member variable.
I am using following code to create an object of class -
com/spss/java_client/core/script/COM/SpssCSApp
// getJvm function returns JavaVM interface pointer that was used while creating jvm
JavaVM* curr_jvm = getJvm();
JNIEnv* t_env;
curr_jvm->AttachCurrentThread((void **)&t_env, NULL);
if (t_env->ExceptionOccurred()) {
t_env->ExceptionDescribe();
}
// Create an instance of ISpssApp
csAppClazz = t_env->FindClass("com/spss/java_client/core/script/COM/SpssCSApp");
if (t_env->ExceptionOccurred()) {
t_env->ExceptionDescribe();
}
jmethodID mid = t_env->GetMethodID(csAppClazz, "<init>", "()V");
if (t_env->ExceptionOccurred()) {
t_env->ExceptionDescribe();
}
csApp = t_env->NewObject(csAppClazz, mid);
if (t_env->ExceptionOccurred()) {
t_env->ExceptionDescribe();
}
After the call to t_env->FindClass my VC++ debug output shows following error -
First-chance exception at 0x00cb74bf in JNIEXE.exe: 0xC0000005: Access violation reading location 0x00000000
But the subsequent call to t_env->ExceptionOccurred returns false.
Also rest of the program runs fine.
I mean even if this exception is shown in debug output window, the creation of new objects in JVM doesn't fail.
So i am not able to detect what is the cause of this exception.
Can anybody help me out with this problem.