You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@locus.apache.org on 2000/05/05 19:00:33 UTC

cvs commit: jakarta-tomcat/src/native/jk jk_jni_worker.c jk_worker.c

costin      00/05/05 10:00:33

  Modified:    src/native/apache2.0 mod_jk.c
               src/native/jk jk_jni_worker.c jk_worker.c
  Log:
  Added more error messages for failure situations. This is usefull when the config is not
  set up corectly - you can see exactly what's broken.
  
  Revision  Changes    Path
  1.4       +2 -1      jakarta-tomcat/src/native/apache2.0/mod_jk.c
  
  Index: mod_jk.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/native/apache2.0/mod_jk.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- mod_jk.c	2000/05/01 12:31:42	1.3
  +++ mod_jk.c	2000/05/05 17:00:32	1.4
  @@ -564,7 +564,7 @@
       jk_server_conf_t *conf =
           (jk_server_conf_t *)ap_get_module_config(s->module_config, &jk_module);
   
  -    fprintf(stdout, "jk_post_config %s\n", p ? p : "NULL"); fflush(stdout);
  +    fprintf(stdout, "jk_child_init %s\n", p ? p : "NULL"); fflush(stdout);
           
       if(conf->log_file && conf->log_level >= 0) {
           if(!jk_open_file_logger(&(conf->log), conf->log_file, conf->log_level)) {
  @@ -575,6 +575,7 @@
       }
       
       if(!uri_worker_map_alloc(&(conf->uw_map), conf->uri_to_context, conf->log)) {
  +	printf( "Memory error - uri worker alloc \n");
           jk_error_exit(APLOG_MARK, APLOG_EMERG, s, "Memory error");
       }
   
  
  
  
  1.3       +38 -17    jakarta-tomcat/src/native/jk/jk_jni_worker.c
  
  Index: jk_jni_worker.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/native/jk/jk_jni_worker.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- jk_jni_worker.c	2000/05/01 12:30:32	1.2
  +++ jk_jni_worker.c	2000/05/05 17:00:33	1.3
  @@ -57,7 +57,7 @@
    * Description: In process JNI worker                                      *
    * Author:      Gal Shachor <sh...@il.ibm.com>                           *
    * Based on:                                                               *
  - * Version:     $Revision: 1.2 $                                               *
  + * Version:     $Revision: 1.3 $                                               *
    ***************************************************************************/
   
   #ifndef WIN32
  @@ -235,6 +235,7 @@
           char *str_config = NULL;
           JNIEnv *env;
   
  +	jk_log(l, JK_LOG_DEBUG, "Into jni_validate\n"); 
           if(p->was_verified) {
               return JK_TRUE;
           }
  @@ -252,6 +253,7 @@
           }
   
           if(!p->tomcat_classpath) {
  +	    jk_log(l, JK_LOG_EMERG, "Fail-> no classpath\n"); 
               return JK_FALSE;
           }
   
  @@ -261,6 +263,7 @@
   
           if(!p->jvm_dll_path || 
               !jk_file_exists(p->jvm_dll_path)) {
  +	    jk_log(l, JK_LOG_EMERG, "Fail-> no jvm_dll_path\n"); 
               return JK_FALSE;
           }
   
  @@ -285,23 +288,34 @@
           }
   
   
  -        if(load_jvm_dll(p, l)) {
  -            if(open_jvm(p, &env, l)) {
  -                if(get_bridge_object(p, env, l)) {
  -                    if(get_method_ids(p, env, l)) {
  -                        p->was_verified = JK_TRUE;
  -                        return JK_TRUE;
  -                    }
  -                }
  -            }            
  -        }
  +        if( ! load_jvm_dll(p, l)) {
  +	    jk_log(l, JK_LOG_EMERG, "Fail-> can't load jvm dll\n"); 
  +	    detach_from_jvm(p);
  +	    return JK_FALSE;
  +	}
  +
  +	if( ! open_jvm(p, &env, l)) {
  +	    jk_log(l, JK_LOG_EMERG, "Fail-> can't open jvm\n"); 
  +	    detach_from_jvm(p);
  +	    return JK_FALSE;
  +	}
  +
  +	if( ! get_bridge_object(p, env, l)) {
  +	    jk_log(l, JK_LOG_EMERG, "Fail-> can't get bridge object\n"); 
  +	    detach_from_jvm(p);
  +	    return JK_FALSE;
  +	}
  +	
  +	if( ! get_method_ids(p, env, l)) {
  +	    jk_log(l, JK_LOG_EMERG, "Fail-> can't get method ids\n"); 
  +	    detach_from_jvm(p);
  +	    return JK_FALSE;
  +	}
   
  -        if(p->jvm) {
  -            detach_from_jvm(p);
  -        }
  +	p->was_verified = JK_TRUE;
  +	return JK_TRUE;
       }
  -
  -    return JK_FALSE;
  +    
   }
   
   static int JK_METHOD init(jk_worker_t *pThis,
  @@ -321,6 +335,7 @@
              !p->jk_service_method     ||
              !p->jk_startup_method     ||
              !p->jk_shutdown_method) {
  +	    jk_log(l, JK_LOG_EMERG, "Fail-> worker not set completely\n"); 
               return JK_FALSE;
           }
          
  @@ -353,6 +368,7 @@
                   p->was_initialized = JK_TRUE; 
                   return JK_TRUE;
               }
  +	    jk_log(l, JK_LOG_EMERG, "Fail-> result from call is 0\n"); 
               return JK_FALSE;
           }
       }
  @@ -515,9 +531,11 @@
   {
       JDK1_1InitArgs vm_args;  
       JNIEnv *penv;
  +    int err;
       *env = NULL;
   
       if(0 != jni_get_default_java_vm_init_args(&vm_args)) {
  +	jk_log(l, JK_LOG_EMERG, "Fail-> can't get default vm init args\n"); 
           return JK_FALSE;
       }
   
  @@ -535,6 +553,7 @@
                       vm_args.classpath);
               p->tomcat_classpath = tmp;
           } else {
  +	    jk_log(l, JK_LOG_EMERG, "Fail-> allocation error for classpath\n"); 
               return JK_FALSE;
           }
       }
  @@ -552,9 +571,10 @@
           vm_args.properties = p->sysprops;
       }
   
  -    if(jni_create_java_vm(&(p->jvm), 
  +    if(err=jni_create_java_vm(&(p->jvm), 
                             &penv, 
                             &vm_args) != 0) {
  +	jk_log(l, JK_LOG_EMERG, "Fail-> create java vm %d \n", err); 
           return JK_FALSE;
       }
   
  @@ -640,5 +660,6 @@
   
   static void detach_from_jvm(jni_worker_t *p)
   {
  +    if(p->jvm == NULL ) return;
       (*(p->jvm))->DetachCurrentThread(p->jvm);
   }
  
  
  
  1.2       +9 -4      jakarta-tomcat/src/native/jk/jk_worker.c
  
  Index: jk_worker.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/native/jk/jk_worker.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- jk_worker.c	2000/04/17 09:47:21	1.1
  +++ jk_worker.c	2000/05/05 17:00:33	1.2
  @@ -56,7 +56,7 @@
   /***************************************************************************
    * Description: Workers controller                                         *
    * Author:      Gal Shachor <sh...@il.ibm.com>                           *
  - * Version:     $Revision: 1.1 $                                               *
  + * Version:     $Revision: 1.2 $                                               *
    ***************************************************************************/
   
   #include "jk_ajp12_worker.h"
  @@ -177,10 +177,15 @@
           }
           
           jk_log(l, JK_LOG_DEBUG, "wc_create_worker, about to validate and init %s\n", name);         
  -        if(!w->validate(w, init_data, l) ||
  -           !w->init(w, init_data, l)) {
  +        if(!w->validate(w, init_data, l)) {
               w->destroy(&w, l);
  -            jk_log(l, JK_LOG_ERROR, "wc_create_worker validate/init failed for %s\n", 
  +            jk_log(l, JK_LOG_ERROR, "wc_create_worker validate failed for %s\n", 
  +                   name); 
  +            return JK_FALSE;
  +	}
  +	if(!w->init(w, init_data, l)) {
  +            w->destroy(&w, l);
  +            jk_log(l, JK_LOG_ERROR, "wc_create_worker init failed for %s\n", 
                      name); 
               return JK_FALSE;
           }