I am trying to make inprocess tomcat work with Apache 2.0 without much success.
I am using j-t-c mod_jk from cvs. First I noticed that since Apache calls module initialization twice jni worker fails when trying to load jvm the second time. I found in the archives that that issue has been adressed in the mod_jk that goes along tomcat 3.3 so I took changes to loading JVM and applied them to j-t-c jk_jni_worker.c. Now JVM initializes properly but it failes when calling tomcat inside service() method. Maybe there are more changes neccessary to make it work? Note that when I temporarly "fix" Apache to avoid double call to initialization all works fine. Any ideas? Thanks Julius Here is the patch that I applied to j-t-c jk_jni_worker.c Index: jk_jni_worker.c =================================================================== RCS file: /home/cvspublic/jakarta-tomcat-connectors/jk/native/common/jk_jni_worker.c,v retrieving revision 1.6 diff -u -r1.6 jk_jni_worker.c --- jk_jni_worker.c 2001/11/17 06:00:24 1.6 +++ jk_jni_worker.c 2001/12/04 17:26:50 @@ -751,9 +751,10 @@ dlerror()); } else { jni_create_java_vm = dlsym(handle, "JNI_CreateJavaVM"); + jni_get_created_java_vms = dlsym(handle, "JNI_GetCreatedJavaVMs"); jni_get_default_java_vm_init_args = dlsym(handle, "JNI_GetDefaultJavaVMInitArgs"); - if(jni_create_java_vm && jni_get_default_java_vm_init_args) { + if(jni_create_java_vm && jni_get_default_java_vm_init_args && jni_get_created_java_vms) { jk_log(l, JK_LOG_DEBUG, "In load_jvm_dll, symbols resolved, done\n"); return JK_TRUE; @@ -931,7 +932,7 @@ int optn = 0, err; char* tmp; - *env = NULL; + *env = penv = NULL; jk_log(l, JK_LOG_DEBUG, "Into open_jvm2\n"); @@ -992,10 +993,25 @@ } jk_log(l, JK_LOG_DEBUG, "In open_jvm2, about to create JVM...\n"); + + err=jni_create_java_vm(&(p->jvm), &penv, &vm_args); + + if (JNI_EEXIST == err) + { + int vmCount; + jk_log(l, JK_LOG_DEBUG, "JVM alread instantiated. Trying to attach instead.\n"); + + jni_get_created_java_vms(&(p->jvm), 1, &vmCount); + if (NULL != p->jvm) + penv = attach_to_jvm(p, l); - if((err=jni_create_java_vm(&(p->jvm), &penv, &vm_args)) != 0) { + if (NULL != penv) + err = 0; + } + + if(err != 0) { jk_log(l, JK_LOG_EMERG, "Fail-> could not create JVM, code: %d \n", err); - return JK_FALSE; + return JK_FALSE; } jk_log(l, JK_LOG_DEBUG, "In open_jvm2, JVM created, done\n"); -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>