Dying on NewObject() call?!?!?!?!?
Hi I'm have a java app that calls a native C function. That native C function returns an array of structures back to the java side. My Code is below:
//this function is to return a array of structures
JNIEXPORT jobjectArray JNICALL Java_CBroker_querySystemConfigurationCSide
(JNIEnv *env, jclass cls) {
int i;
int numSysConfigs = 1;
jclass sysConfigDataClass = (*env)->FindClass(env, "SysConfigData");
if ((*env)->ExceptionOccurred(env)) {
(*env)->ExceptionDescribe(env);
}
if (sysConfigDataClass == NULL) {
printf( "Can't find Java SysConfigData class\n");
exit(1);
}
jmethodID midCtor;
/* get a handle to the constructor method */
if (midCtor == NULL) {
midCtor = (*env)->GetMethodID(env, sysConfigDataClass, "<init>","()V");
if ((*env)->ExceptionOccurred(env)) {
(*env)->ExceptionDescribe(env);
}
if (midCtor == NULL) {
printf("Can't get method id...\n");
}
}
jobjectArray retObjArray =
(jobjectArray) (*env)->NewObjectArray(env, numSysConfigs, sysConfigDataClass, NULL);
if ((*env)->ExceptionOccurred(env)) {
(*env)->ExceptionDescribe(env);
}
if (retObjArray == 0){
printf("NewObjectArray() -- Out of memory\n");
exit(1);
}
for (i=0;i<numSysConfigs;i++) {
//create a new sysConfigClass object for each of my numSysConfigs
jobject obj = (*env)->NewObject(env, sysConfigDataClass, midCtor, "");//DIES HERE!!!!
if ((*env)->ExceptionOccurred(env)) {
(*env)->ExceptionDescribe(env);
}
} //end for
.....
...
......
any idea why I'm dying on that NewObject call?!?!?!The error that spits out is:
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# SIGSEGV (0xb) at pc=0x011cfa20, pid=780, tid=28441520
#
# Java VM: Java HotSpot(TM) Server VM (1.5.0_02-b09 mixed mode)
# Problematic frame:
# V [libjvm.so+0x29fa20]
#
# An error report file with more information is saved as hs_err_pid780.log
#
# If you would like to submit a bug report, please visit:
#http://java.sun.com/webapps/bugreport/crash.jsp
#

