JVM breaks on JNI related code.

Hi,

I'm fairly new to JNI /java programming. So I have no clue if I should search this in the direction of a JVM bug or a code error.

I get a JVM crash at the following code:

/*

* Class:jOTDB_jOTDBconnection

* Method:getTreeList

* Signature: ()Ljava/util/Vector;

*/

JNIEXPORT jobject JNICALL Java_jOTDB_jOTDBconnection_getTreeList

(JNIEnv *env, jobject, jshort treeType, jshort classifiType)

{

vector<OTDBtree> trees = OTDBconn->getTreeList(treeType, classifiTy

pe);

vector<OTDBtree>::iterator treeIterator;

// Construct java Vector

jobject itemVector;

jclass class_Vector = env->FindClass"java/lang/Vector");

cout <<"before construct java vector" << endl;

jmethodID mid_Vector_cons = env->GetMethodID(class_Vector,"<init>"

,"()V");

cout <<"after construct java vector" << endl;

itemVector = env->NewObject(class_Vector, mid_Vector_cons);

jmethodID mid_Vector_add = env->GetMethodID(class_Vector,"add","(

Ljava/lang/Object;)Z");

for (treeIterator = trees.begin(); treeIterator != trees.end(); tre

eIterator++)

{

env->CallObjectMethod(itemVector, mid_Vector_add, convertOTDBt

ree(env, *treeIterator));

}

return(itemVector);

}

The JVM breaks at the statement:

jmethodID mid_Vector_cons = env->GetMethodID(class_Vector,"<init>"

,"()V");

The first part of the JVM dump:

before construct java vector

#

# An unexpected error has been detected by HotSpot Virtual Machine:

#

# SIGSEGV (0xb) at pc=0x401b7696, pid=2884, tid=1182344768

#

# Java VM: Java HotSpot(TM) Client VM (1.5.0_04-b05 mixed mode, sharing)

# Problematic frame:

# V [libjvm.so+0x18f696]

the construction above I have seen in a lot of code examples, so I have no clue where to start looking

[2514 byte] By [A_Coolena] at [2007-10-2 11:18:50]
# 1
Forgive my hastely posting.I think I found the error:jclass class_Vector = env->FindClass("java/util/Vector");Should be from UTIL not LANGI guess the error message could have been a TIDY bit more clear :)sorry to have disturbed you
A_Coolena at 2007-7-13 4:17:34 > top of Java-index,Java Essentials,Java Programming...
# 2
I thought Vector was in package java.util not java.lang!
sabre150a at 2007-7-13 4:17:34 > top of Java-index,Java Essentials,Java Programming...
# 3
:-) Boy am I slow today! Several hours slow!
sabre150a at 2007-7-13 4:17:34 > top of Java-index,Java Essentials,Java Programming...
# 4
It's java.util.Vector.;) Waiting for Jos...
CeciNEstPasUnProgrammeura at 2007-7-13 4:17:34 > top of Java-index,Java Essentials,Java Programming...
# 5
> It's java.util.Vector.> > > ;) Waiting for Jos...Allegedly Jos is still in bed! Allegedly he gets up at 12:00 UTC.
sabre150a at 2007-7-13 4:17:34 > top of Java-index,Java Essentials,Java Programming...