costin 02/04/17 17:12:00 Modified: jk/native2/common jk_worker_jni.c Log: Few hacks to deal with the 3 versions of tomcat. I first tried to allow multiple class names to be specified, and the first one found to be used. That worked, but it seems 4.1 is blocking in the main thread. So I added a quick hack to call main in a separate thread ( that's also nice because Apache will not have to wait for all tomcat initializations when in-process ). Revision Changes Path 1.9 +30 -3 jakarta-tomcat-connectors/jk/native2/common/jk_worker_jni.c Index: jk_worker_jni.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_jni.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- jk_worker_jni.c 13 Apr 2002 05:34:21 -0000 1.8 +++ jk_worker_jni.c 18 Apr 2002 00:12:00 -0000 1.9 @@ -69,12 +69,14 @@ #include "jni.h" /* default only, will be configurable */ -#define JAVA_BRIDGE_CLASS_NAME ("org/apache/jk/server/JkMain") +#define JAVA_BRIDGE_CLASS_NAME ("org/apache/jk/apr/AprImpl") struct jni_worker_data { jclass jk_java_bridge_class; jmethodID jk_main_method; char *className; + /* Hack to allow multiple 'options' for the class name */ + char **classNameOptions; char **args; int nArgs; }; @@ -129,7 +131,16 @@ jniWorker = pThis->worker_private; if( strcmp( name, "class" )==0 ) { - jniWorker->className = value; + if( jniWorker->className != NULL ) { + int i; + for( i=0; i<4; i++ ) { + if( jniWorker->classNameOptions[i]==NULL ) { + jniWorker->classNameOptions[i]=value; + } + } + } else { + jniWorker->className = value; + } } else if( strcmp( name, "ARG" )==0 ) { jniWorker->args[jniWorker->nArgs]=value; jniWorker->nArgs++; @@ -189,7 +200,22 @@ (*jniEnv)->FindClass(jniEnv, jniWorker->className ); if( jniWorker->jk_java_bridge_class == NULL ) { - env->l->jkLog(env, env->l, JK_LOG_EMERG, + int i; + for( i=0;i<4; i++ ) { + if( jniWorker->classNameOptions[i] != NULL ) { + env->l->jkLog(env, env->l, JK_LOG_INFO, + "jni.validate() try %s \n", + jniWorker->classNameOptions[i]); + jniWorker->jk_java_bridge_class = + (*jniEnv)->FindClass(jniEnv, jniWorker->classNameOptions[i] ); + if(jniWorker->jk_java_bridge_class != NULL ) + break; + } + } + } + + if( jniWorker->jk_java_bridge_class == NULL ) { + env->l->jkLog(env, env->l, JK_LOG_ERROR, "Can't find class %s\n", jniWorker->className ); /* [V] the detach here may segfault on 1.1 JVM... */ vm->detach(env, vm); @@ -309,6 +335,7 @@ _this->pool=pool; jniData->jk_java_bridge_class = NULL; + jniData->classNameOptions=(char **)pool->calloc(env, pool, 4 * sizeof(char *)); jniData->args = pool->calloc( env, pool, 64 * sizeof( char *)); jniData->nArgs =0;
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>