cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
mturk 2004/03/15 03:53:05 Modified:jk/native2/common jk_vm_default.c Log: Removed the childGeneration checking Revision ChangesPath 1.33 +0 -7 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- jk_vm_default.c 24 Feb 2004 08:44:40 - 1.32 +++ jk_vm_default.c 15 Mar 2004 11:53:05 - 1.33 @@ -611,13 +611,6 @@ workerEnv=env-getByName( env, workerEnv ); -/* TODO: use timeframe for child generation - * -*/ -if (workerEnv-childGeneration 10) { -result-disabled = 1; -return JK_OK; -} jkvm = (jk_vm_t *)pool-calloc(env, pool, sizeof(jk_vm_t )); jkvm-pool=pool; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
hgomez 2004/02/13 00:46:37 Modified:jk/native2/common jk_vm_default.c Log: Make line longer but GCC more happy with it :) Revision ChangesPath 1.31 +2 -4 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- jk_vm_default.c 30 Oct 2003 20:08:36 - 1.30 +++ jk_vm_default.c 13 Feb 2004 08:46:37 - 1.31 @@ -438,14 +438,12 @@ token = strtok(NULL, PATH_SEPARATOR_STR); } env-l-jkLog(env, env-l, JK_LOG_INFO, - jni.guessJvmDll() could not find %s in the \ - LD_LIBRARY_PATH\n, + jni.guessJvmDll() could not find %s in the LD_LIBRARY_PATH\n, jvm); return NULL; } env-l-jkLog(env, env-l, JK_LOG_INFO, - jni.guessJvmDll() LD_LIBRARY_PATH \ - environment var is not set\n); + jni.guessJvmDll() LD_LIBRARY_PATH environment var is not set\n); return NULL; #else return jvm; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
Henri, If you want to use shorter lines, you can wrap long lines and still compile. For example (in case my patch gets stripped): printf(This is a ) very long line.\n); -Dave [EMAIL PROTECTED] wrote, On 2/13/2004 12:46 AM: hgomez 2004/02/13 00:46:37 Modified:jk/native2/common jk_vm_default.c Log: Make line longer but GCC more happy with it :) Revision ChangesPath 1.31 +2 -4 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- jk_vm_default.c 30 Oct 2003 20:08:36 - 1.30 +++ jk_vm_default.c 13 Feb 2004 08:46:37 - 1.31 @@ -438,14 +438,12 @@ token = strtok(NULL, PATH_SEPARATOR_STR); } env-l-jkLog(env, env-l, JK_LOG_INFO, - jni.guessJvmDll() could not find %s in the \ - LD_LIBRARY_PATH\n, + jni.guessJvmDll() could not find %s in the LD_LIBRARY_PATH\n, jvm); return NULL; } env-l-jkLog(env, env-l, JK_LOG_INFO, - jni.guessJvmDll() LD_LIBRARY_PATH \ - environment var is not set\n); + jni.guessJvmDll() LD_LIBRARY_PATH environment var is not set\n); return NULL; #else return jvm; --- jk_vm_default.c 2004-02-13 01:11:35.030758871 -0800 +++ jk_vm_default.c.orig2004-02-13 01:11:56.446292854 -0800 @@ -438,14 +438,12 @@ token = strtok(NULL, PATH_SEPARATOR_STR); } env-l-jkLog(env, env-l, JK_LOG_INFO, - jni.guessJvmDll() could not find %s in the - LD_LIBRARY_PATH\n, + jni.guessJvmDll() could not find %s in the LD_LIBRARY_PATH\n, jvm); return NULL; } env-l-jkLog(env, env-l, JK_LOG_INFO, - jni.guessJvmDll() LD_LIBRARY_PATH - environment var is not set\n); + jni.guessJvmDll() LD_LIBRARY_PATH environment var is not set\n); return NULL; #else return jvm; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
David Rees wrote, On 2/13/2004 1:14 AM: If you want to use shorter lines, you can wrap long lines and still compile. For example (in case my patch gets stripped): printf(This is a ) very long line.\n); Oops, my patch was reversed. Here's a good one. -Dave --- jk_vm_default.c.orig2004-02-13 01:11:56.446292854 -0800 +++ jk_vm_default.c 2004-02-13 01:11:35.030758871 -0800 @@ -438,12 +438,14 @@ token = strtok(NULL, PATH_SEPARATOR_STR); } env-l-jkLog(env, env-l, JK_LOG_INFO, - jni.guessJvmDll() could not find %s in the LD_LIBRARY_PATH\n, + jni.guessJvmDll() could not find %s in the + LD_LIBRARY_PATH\n, jvm); return NULL; } env-l-jkLog(env, env-l, JK_LOG_INFO, - jni.guessJvmDll() LD_LIBRARY_PATH environment var is not set\n); + jni.guessJvmDll() LD_LIBRARY_PATH + environment var is not set\n); return NULL; #else return jvm; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
David Rees wrote: David Rees wrote, On 2/13/2004 1:14 AM: If you want to use shorter lines, you can wrap long lines and still compile. For example (in case my patch gets stripped): printf(This is a ) very long line.\n); Oops, my patch was reversed. Here's a good one. Are you sure it will works on non gcc compiler ? I'd like to see Jean-Frederic opinion :) (exotic os/hardware) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
Henri Gomez wrote: David Rees wrote: David Rees wrote, On 2/13/2004 1:14 AM: If you want to use shorter lines, you can wrap long lines and still compile. For example (in case my patch gets stripped): printf(This is a ) very long line.\n); Oops, my patch was reversed. Here's a good one. Are you sure it will works on non gcc compiler ? I'd like to see Jean-Frederic opinion :) (exotic os/hardware) -1: +++ bash-2.03$ make toto cc-c -o toto.o toto.c toto.c, line 4: syntax error before or at: very long line.\n cc: acomp failed for toto.c make: *** [toto.o] Error 2 bash-2.03$ uname -a SunOS PGTR0327 5.8 Generic_108528-13 sun4us sparc FJSV,GPUS +++ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
Henri Gomez wrote, On 2/13/2004 3:08 AM: Are you sure it will works on non gcc compiler ? I'd like to see Jean-Frederic opinion :) (exotic os/hardware) Does not look like it does, but at least now you'll know that if you're writing gcc specific code you can do it. ;-) The only non-gcc compiler I have access to is SGI's MIPSpro 7.2.1 where it does work there. Too bad not all compilers support it, it can make code a lot more readable. -Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
David Rees wrote: Henri Gomez wrote, On 2/13/2004 3:08 AM: Are you sure it will works on non gcc compiler ? I'd like to see Jean-Frederic opinion :) (exotic os/hardware) Does not look like it does, but at least now you'll know that if you're writing gcc specific code you can do it. ;-) The only non-gcc compiler I have access to is SGI's MIPSpro 7.2.1 where it does work there. Too bad not all compilers support it, it can make code a lot more readable. In JK, we have to live with many OS and many compilers, Unixes (BSDs', Linux's, AIX, HPUX, Solaris), Windows, Netware, OS400, BS2000, . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
mturk 2002/11/06 23:27:18 Modified:jk/native2/common jk_vm_default.c Log: Rename the error hook to the exit (that's it real pupose after all). Revision ChangesPath 1.28 +9 -7 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- jk_vm_default.c 6 Nov 2002 16:32:25 - 1.27 +++ jk_vm_default.c 7 Nov 2002 07:27:18 - 1.28 -185,23 +185,25 #endif /* JVM hooks */ -static int jk2_jni_error_signaled = JK_FALSE; -static int jk2_jni_error_code = 0; +static int jk2_jni_exit_signaled = JK_FALSE; +static int jk2_jni_exit_code = 0; static int jk2_jni_abort_signaled = JK_FALSE; -static void jk2_jni_error_hook(int code) +static void jk2_jni_exit_hook(int code) { -jk2_jni_error_signaled = JK_TRUE; -jk2_jni_error_code = code; +jk2_jni_exit_signaled = JK_TRUE; +jk2_jni_abort_signaled = JK_TRUE; +jk2_jni_exit_code = code; #ifdef DEBUG -fprintf(stderr, JVM error hook called %d\n, code); +fprintf(stderr, JVM exit hook called %d\n, code); #endif } static void jk2_jni_abort_hook() { jk2_jni_abort_signaled = JK_TRUE; + #ifdef DEBUG fprintf(stderr, JVM abort hook\n); #endif -567,7 +569,7 /* Set the abort and exit hooks */ options[optn].optionString = exit; -options[optn++].extraInfo = jk2_jni_error_hook; +options[optn++].extraInfo = jk2_jni_exit_hook; options[optn].optionString = abort; options[optn++].extraInfo = jk2_jni_abort_hook; -- To unsubscribe, e-mail: mailto:tomcat-dev-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-dev-help;jakarta.apache.org
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
mturk 2002/10/24 23:52:54 Modified:jk/native2/common jk_vm_default.c Log: Use the PATH_SEPARATOR_STR for classpaths. The used one was the semicolon that is used only on WIN32 Revision ChangesPath 1.24 +12 -6 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- jk_vm_default.c 24 Oct 2002 15:37:18 - 1.23 +++ jk_vm_default.c 25 Oct 2002 06:52:54 - 1.24 -424,27 +424,33 /* Check if the LD_LIBRARY_PATH points to the discovered jvm. * XXX only tested on Linux. */ -ldlib = getenv(LD_LIBRARY_PATH); +#if defined(LINUX) +ldlib = getenv(PATH_ENV_VARIABLE); if (ldlib strlen(ldlib)) { char *token; -token = strtok(ldlib, :); +token = strtok(ldlib, PATH_SEPARATOR_STR); while (token != NULL) { if (strncmp(token, jvm, strlen(token)) == 0) { env-l-jkLog(env, env-l, JK_LOG_INFO, jni.guessJvmDll() found %s in %s.\n, jvm, token); return jvm; } -token = strtok(NULL, :); +token = strtok(NULL, PATH_SEPARATOR_STR); } env-l-jkLog(env, env-l, JK_LOG_INFO, - jni.guessJvmDll() could not find %s in the LD_LIBRARY_PATH\n, + jni.guessJvmDll() could not find %s in the \ + LD_LIBRARY_PATH\n, jvm); return NULL; } env-l-jkLog(env, env-l, JK_LOG_INFO, - jni.guessJvmDll() LD_LIBRARY_PATH environment var is not set\n); + jni.guessJvmDll() LD_LIBRARY_PATH \ + environment var is not set\n); return NULL; +#else +return jvm; +#endif } env-l-jkLog(env, env-l, JK_LOG_INFO, -535,7 +541,7 strcpy(classpath, -Djava.class.path=); strcat(classpath, jkvm-classpath[0]); for (i = 1; i classn; i++) { -strcat(classpath, ;); +strcat(classpath, PATH_SEPARATOR_STR); strcat(classpath, jkvm-classpath[i]); } } -- To unsubscribe, e-mail: mailto:tomcat-dev-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-dev-help;jakarta.apache.org
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
mturk 2002/10/24 08:37:18 Modified:jk/native2/common jk_vm_default.c Log: After guessing JVM check if the file is inside the LD_LIBRARY_PATH. Revision ChangesPath 1.23 +53 -6 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- jk_vm_default.c 15 Oct 2002 13:59:49 - 1.22 +++ jk_vm_default.c 24 Oct 2002 15:37:18 - 1.23 -184,6 +184,24 } #endif +/* JVM hooks */ +static int jk2_jni_error_signaled = JK_FALSE; +static int jk2_jni_error_code = 0; +static int jk2_jni_abort_signaled = JK_FALSE; + +static void jk2_jni_error_hook(int code) +{ +jk2_jni_error_signaled = JK_TRUE; +jk2_jni_error_code = code; + +fprintf(stderr, JVM error hook called %d\n, code); +} + +static void jk2_jni_abort_hook() +{ +jk2_jni_abort_signaled = JK_TRUE; +fprintf(stderr, JVM abort hook\n); +} /** Load the VM. Must be called after init. */ -400,9 +418,33 (char *)p-pstrdup( env, p, *current ) ); if( jvm!=NULL jk2_file_exists(env, jvm)) { +char *ldlib; +env-l-jkLog(env, env-l, JK_LOG_INFO, + jni.guessJvmDll() trying %s\n, jvm); +/* Check if the LD_LIBRARY_PATH points to the discovered jvm. + * XXX only tested on Linux. + */ +ldlib = getenv(LD_LIBRARY_PATH); +if (ldlib strlen(ldlib)) { +char *token; + +token = strtok(ldlib, :); +while (token != NULL) { +if (strncmp(token, jvm, strlen(token)) == 0) { +env-l-jkLog(env, env-l, JK_LOG_INFO, + jni.guessJvmDll() found %s in %s.\n, jvm, token); +return jvm; +} +token = strtok(NULL, :); +} +env-l-jkLog(env, env-l, JK_LOG_INFO, + jni.guessJvmDll() could not find %s in the LD_LIBRARY_PATH\n, + jvm); +return NULL; +} env-l-jkLog(env, env-l, JK_LOG_INFO, - jni.guessJvmDll() %s\n, jvm); -return jvm; + jni.guessJvmDll() LD_LIBRARY_PATH environment var is not set\n); +return NULL; } env-l-jkLog(env, env-l, JK_LOG_INFO, -485,8 +527,6 return JK_ERR; } -vm_args.version = JNI_VERSION_1_2; -vm_args.options = options; for (classn = 0; classn jkvm-nClasspath; classn++) classl += strlen(jkvm-classpath[classn]); if (classl) { -513,9 +553,16 vm.openJvm2() Classpath: %s\n, classpath); options[optn++].optionString = classpath; } - -vm_args.nOptions = optn; +/* Set the abort and exit hooks */ +options[optn].optionString = exit; +options[optn++].extraInfo = jk2_jni_error_hook; +options[optn].optionString = abort; +options[optn++].extraInfo = jk2_jni_abort_hook; + +vm_args.version = JNI_VERSION_1_2; +vm_args.options = options; +vm_args.nOptions = optn; vm_args.ignoreUnrecognized = JNI_TRUE; err=jni_create_java_vm(jvm, penv, vm_args); -- To unsubscribe, e-mail: mailto:tomcat-dev-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-dev-help;jakarta.apache.org
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
mturk 2002/10/15 06:59:49 Modified:jk/native2/common jk_vm_default.c Log: Add the classpath option to the vm: Revision ChangesPath 1.22 +35 -9 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- jk_vm_default.c 8 Jul 2002 13:35:02 - 1.21 +++ jk_vm_default.c 15 Oct 2002 13:59:49 - 1.22 @@ -424,10 +424,11 @@ jk_map_t *props=jkvm-properties; JavaVMInitArgs vm_args; JNIEnv *penv; -JavaVMOption options[100]; +JavaVMOption options[JK2_MAXOPTIONS * 2]; JavaVM *jvm; -int optn = 0, err; - +int optn = 0, err, classn = 0, classl = 0, i; +char *classpath = NULL; + /** Make sure we have the vm dll */ if( jkvm-jvm_dll_path ==NULL || ! jk2_file_exists(env, jkvm-jvm_dll_path )) { @@ -486,14 +487,32 @@ vm_args.version = JNI_VERSION_1_2; vm_args.options = options; - +for (classn = 0; classn jkvm-nClasspath; classn++) +classl += strlen(jkvm-classpath[classn]); +if (classl) { +classpath = jkvm-pool-calloc(env, jkvm-pool, + classl + classn + sizeof(-Djava.class.path=)); +strcpy(classpath, -Djava.class.path=); +strcat(classpath, jkvm-classpath[0]); +for (i = 1; i classn; i++) { +strcat(classpath, ;); +strcat(classpath, jkvm-classpath[i]); +} +} while(jkvm-options[optn]) { -env-l-jkLog(env, env-l, JK_LOG_INFO, - vm.openJvm2() Option: %s\n, jkvm-options[optn]); +if (jkvm-mbean-debug 1) +env-l-jkLog(env, env-l, JK_LOG_DEBUG, + vm.openJvm2() Option: %s\n, jkvm-options[optn]); /* Pass it as is */ options[optn].optionString = jkvm-options[optn]; optn++; } +if (classpath) { +if (jkvm-mbean-debug 1) +env-l-jkLog(env, env-l, JK_LOG_DEBUG, + vm.openJvm2() Classpath: %s\n, classpath); +options[optn++].optionString = classpath; +} vm_args.nOptions = optn; @@ -557,10 +576,18 @@ char *value=valueP; if( strcmp( name, OPT )==0 ) { -jkvm-options[jkvm-nOptions]=value; -jkvm-nOptions++; +if (jkvm-nOptions JK2_MAXOPTIONS) { +jkvm-options[jkvm-nOptions]=value; +jkvm-nOptions++; +} } else if( strcmp( name, JVM )==0 ) { jkvm-jvm_dll_path=value; +} +else if( strcmp( name, classpath )==0 ) { +if (jkvm-nClasspath JK2_MAXOPTIONS) { +jkvm-classpath[jkvm-nClasspath]=value; +jkvm-nClasspath++; +} } else { return JK_ERR; } @@ -580,7 +607,6 @@ jkvm-pool=pool; jkvm-jvm_dll_path = NULL; -jkvm-options = pool-calloc( env, pool, 64 * sizeof( char *)); jkvm-nOptions =0; jkvm-init=jk2_vm_initVM; -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
mturk 2002/07/08 06:35:02 Modified:jk/native2/common jk_vm_default.c Log: no message Revision ChangesPath 1.21 +5 -5 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- jk_vm_default.c 5 Jul 2002 08:06:51 - 1.20 +++ jk_vm_default.c 8 Jul 2002 13:35:02 - 1.21 @@ -237,7 +237,7 @@ } if( jkvm-mbean-debug 0 ) -env-l-jkLog(env, env-l, JK_LOG_INFO, +env-l-jkLog(env, env-l, JK_LOG_DEBUG, jni.loadJvm() %s symbols resolved\n, jkvm-jvm_dll_path); @@ -273,8 +273,8 @@ appropriate interface. There is no need to call the AttachCurrentThread. */ if( err == 0) { -if( jkvm-mbean-debug 0 ) -env-l-jkLog(env, env-l, JK_LOG_INFO, vm.attach() allready attached\n); +if( jkvm-mbean-debug = 0 ) +env-l-jkLog(env, env-l, JK_LOG_DEBUG, vm.attach() allready attached\n); return (void *)rc; } /* The error code is either JNI_OK (allready attached) or JNI_EDETACHED. @@ -295,8 +295,8 @@ vm.attach() error %d\n, err); return NULL; } -if( jkvm-mbean-debug 0 ) -env-l-jkLog(env, env-l, JK_LOG_INFO, vm.attach() ok\n); +if( jkvm-mbean-debug = 0 ) +env-l-jkLog(env, env-l, JK_LOG_DEBUG, vm.attach() ok\n); return (void *)rc; } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
mturk 2002/07/01 08:45:20 Modified:jk/native2/common jk_vm_default.c Log: Add the destroy callback that calls the DestroyJavaVM Revision ChangesPath 1.19 +20 -0 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- jk_vm_default.c 11 Jun 2002 21:19:31 - 1.18 +++ jk_vm_default.c 1 Jul 2002 15:45:20 - 1.19 @@ -613,6 +613,25 @@ return JK_OK; } +static void jk2_vm_destroy(jk_env_t *env, jk_vm_t *jkvm) +{ +int err; +JavaVM *jvm = (JavaVM *)jkvm-jvm; + +if( jvm == NULL ) { +return; +} + +err= (*jvm)-DestroyJavaVM(jvm); +if(err == 0 ) { +env-l-jkLog(env, env-l, JK_LOG_INFO, + vm.destroy() ok\n); +} else { +env-l-jkLog(env, env-l, JK_LOG_ERROR, + vm.destroy() cannot destroy the JVM.\n); +} +} + static int JK_METHOD jk2_jk_vm_setProperty(jk_env_t *env, jk_bean_t *mbean, char *name, void *valueP ) { @@ -649,6 +668,7 @@ jkvm-init=jk2_vm_initVM; jkvm-attach=jk2_vm_attach; jkvm-detach=jk2_vm_detach; +jkvm-destroy=jk2_vm_destroy; result-object=jkvm; result-setAttribute=jk2_jk_vm_setProperty; -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
nacho 2002/06/11 14:19:31 Modified:jk/native2/common jk_vm_default.c Log: The patch deals with unnecesary calls to the AttachCurrentThread if the GetEnv returns valid environment. The second part of patch uses WIN32 registry to guess the correct jvm.dll like Java does itself. Submitted by Mladen Turk. Revision ChangesPath 1.18 +66 -4 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- jk_vm_default.c 10 Jun 2002 21:55:06 - 1.17 +++ jk_vm_default.c 11 Jun 2002 21:19:31 - 1.18 @@ -351,10 +351,22 @@ #endif err= (*jvm)-GetEnv( jvm, (void **)rc, JNI_VERSION_1_2 ); -if( ( err != 0 ) -( err != JNI_EDETACHED) ) { -env-l-jkLog(env, env-l, JK_LOG_INFO, +/* If the current thread is allready attached to the VM return the + appropriate interface. There is no need to call the AttachCurrentThread. +*/ +if( err == 0) { +if( jkvm-mbean-debug 0 ) +env-l-jkLog(env, env-l, JK_LOG_INFO, vm.attach() allready attached\n); +return rc; +} +/* The error code is either JNI_OK (allready attached) or JNI_EDETACHED. + Othere possibility is that specified version is not supported, + and the returned err in that case is JNI_EVERSION. +*/ +if( err != JNI_EDETACHED) { +env-l-jkLog(env, env-l, JK_LOG_ERROR, vm.attach() GetEnv failed %d\n, err); +return NULL; } err = (*jvm)-AttachCurrentThread(jvm, @@ -406,6 +418,56 @@ /* Some guessing - to spare the user ( who might know less than we do ). */ +#ifdef WIN32 +/* On WIN32 use the Registry couse Java itself relies on that. +*/ +#define JAVASOFT_REGKEY SOFTWARE\\JavaSoft\\Java Runtime Environment\\ + +static char* jk2_vm_guessJvmDll(jk_env_t *env, jk_map_t *props, + jk_vm_t *jkvm) +{ +HKEY hkjs; +static char jvm[MAX_PATH+1]; +char reg[MAX_PATH+1]; +char *cver; +jk_pool_t *p=props-pool; +unsigned int err, klen = MAX_PATH; + + strcpy(reg, JAVASOFT_REGKEY); + cver = reg[sizeof(JAVASOFT_REGKEY)-1]; +if( (err=RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg, + 0, KEY_READ, hkjs) ) != ERROR_SUCCESS) { +env-l-jkLog(env, env-l, JK_LOG_INFO, + jni.guessJvmDll() failed to open Registry key\n); + return NULL; + } +if( (err=RegQueryValueEx(hkjs, CurrentVersion, NULL, NULL, + (unsigned char *)cver, klen) ) != ERROR_SUCCESS) { +env-l-jkLog(env, env-l, JK_LOG_INFO, + jni.guessJvmDll() failed obtaining Current Version\n); + RegCloseKey(hkjs); + return NULL; + } +RegCloseKey(hkjs); +if( (err=RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg, + 0, KEY_READ, hkjs) ) != ERROR_SUCCESS) { +env-l-jkLog(env, env-l, JK_LOG_INFO, + jni.guessJvmDll() failed to open Registry key\n); + return NULL; + } + klen = MAX_PATH; +if( (err=RegQueryValueEx(hkjs, RuntimeLib, NULL, NULL, + (unsigned char *)jvm, klen) ) != ERROR_SUCCESS) { +env-l-jkLog(env, env-l, JK_LOG_INFO, + jni.guessJvmDll() failed obtaining Runtime Library\n); + RegCloseKey(hkjs); + return NULL; + } +RegCloseKey(hkjs); + +return jvm; +} +#else static char* jk2_vm_guessJvmDll(jk_env_t *env, jk_map_t *props, jk_vm_t *jkvm) { @@ -435,7 +497,7 @@ return NULL; } - +#endif static int jk2_vm_initVM(jk_env_t *env, jk_vm_t *jkvm) { -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
costin 02/05/23 21:29:22 Modified:jk/native2/common jk_vm_default.c Log: Use APR to load the DLL ( rather than adding another case for hpux ). The major problem is Netware - the code in APR for dlopen is _very_ different from what we have in jk. If someone who uses that platform can check if apr dlopen works fine, we can remove the commented code. I assume the windows and standard dlopen cases are well tested, so we'll get rid of all this platform-specific code soon. Revision ChangesPath 1.15 +128 -64 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- jk_vm_default.c 16 May 2002 23:48:27 - 1.14 +++ jk_vm_default.c 24 May 2002 04:29:22 - 1.15 @@ -85,15 +85,15 @@ #include jk_config.h -#if !defined(WIN32) !defined(NETWARE) -#include dlfcn.h -#endif #if defined LINUX defined APACHE2_SIGHACK #include pthread.h #include signal.h #include bits/signum.h #endif +#if !defined(WIN32) !defined(NETWARE) +#include dlfcn.h +#endif #ifdef NETWARE #include nwthread.h #include nwadv.h @@ -101,6 +101,11 @@ #include jni.h +#ifdef APR_HAS_DSO +#include apr_dso.h +#endif + + #ifndef JNI_VERSION_1_2 #warning --- @@ -184,72 +189,41 @@ static int jk2_vm_loadJvm(jk_env_t *env, jk_vm_t *jkvm) { - -#ifdef WIN32 -HINSTANCE hInst = LoadLibrary(jkvm-jvm_dll_path); -if(hInst) { -(FARPROC)jni_create_java_vm = -GetProcAddress(hInst, JNI_CreateJavaVM); - -(FARPROC)jni_get_created_java_vms = -GetProcAddress(hInst, JNI_GetCreatedJavaVMs); - -(FARPROC)jni_get_default_java_vm_init_args = -GetProcAddress(hInst, JNI_GetDefaultJavaVMInitArgs); - -env-l-jkLog(env, env-l, JK_LOG_INFO, - jni.loadJvmDll()\n); - -if(jni_create_java_vm - jni_get_default_java_vm_init_args - jni_get_created_java_vms) { -return JK_OK; -} +#if defined(HAS_APR) defined(APR_HAS_DSO) +apr_dso_handle_t *dsoHandle; +apr_status_t rc; +apr_pool_t *aprPool; -FreeLibrary(hInst); -} -return JK_OK; -#elif defined(NETWARE) -int javaNlmHandle = FindNLMHandle(JVM); -if (0 == javaNlmHandle) { -/* if we didn't get a handle, try to load java and retry getting the */ -/* handle */ -spawnlp(P_NOWAIT, JVM.NLM, NULL); -ThreadSwitchWithDelay(); -javaNlmHandle = FindNLMHandle(JVM); -if (0 == javaNlmHandle) -printf(Error loading Java.); +aprPool= (apr_pool_t *)env-getAprPool( env ); + +if( aprPool==NULL ) +return JK_FALSE; +/* XXX How do I specify RTLD_NOW and RTLD_GLOBAL ? */ +rc=apr_dso_load( dsoHandle, jkvm-jvm_dll_path, aprPool ); + +if(rc == APR_SUCCESS ) { +rc= apr_dso_sym( (apr_dso_handle_sym_t *)jni_create_java_vm, dsoHandle, JNI_CreateJavaVM); } -if (0 != javaNlmHandle) { -jni_create_java_vm = ImportSymbol(GetNLMHandle(), JNI_CreateJavaVM); -jni_get_created_java_vms = ImportSymbol(GetNLMHandle(), -JNI_GetCreatedJavaVMs); -jni_get_default_java_vm_init_args = -ImportSymbol(GetNLMHandle(), JNI_GetDefaultJavaVMInitArgs); + +if( rc == APR_SUCCESS ) { +rc=apr_dso_sym( (apr_dso_handle_sym_t *)jni_get_default_java_vm_init_args, dsoHandle, +JNI_GetDefaultJavaVMInitArgs); } -if(jni_create_java_vm - jni_get_default_java_vm_init_args - jni_get_created_java_vms) { -return JK_OK; + +if( rc == APR_SUCCESS ) { +rc=apr_dso_sym( (apr_dso_handle_sym_t *)jni_get_created_java_vms, +dsoHandle, JNI_GetCreatedJavaVMs); } -return JK_OK; -#else -void *handle; -handle = dlopen(jkvm-jvm_dll_path, RTLD_NOW | RTLD_GLOBAL); - -if(handle == NULL ) { -env-l-jkLog(env, env-l, JK_LOG_EMERG, + +if( rc!= APR_SUCCESS ) { +char buf[256]; +env-l-jkLog(env, env-l, JK_LOG_ERROR, Can't load native library %s : %s\n, jkvm-jvm_dll_path, - dlerror()); + apr_dso_error(dsoHandle, buf, 256)); return JK_ERR; } - -jni_create_java_vm = dlsym(handle, JNI_CreateJavaVM); -jni_get_default_java_vm_init_args = -dlsym(handle,
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
costin 02/04/12 16:12:16 Modified:jk/native2/common jk_vm_default.c Log: Remove the JDK1.1 workarounds - it made the code unreadable. If you need 1.1 support - get the old version from CVS and create a separate jk_vm_11.c object. Or use mod_jk1. I also removed a lot of config overhead and reduced the object to it's base function - instantiate a Java VM. worker_jni will call java methods ( like start tomcat ), while channel_jni will forward the requests ( using Ajp13 encoding and protocol ) Revision ChangesPath 1.8 +116 -511 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- jk_vm_default.c 12 Apr 2002 21:49:03 - 1.7 +++ jk_vm_default.c 12 Apr 2002 23:12:16 - 1.8 @@ -74,6 +74,7 @@ * @author: Costin Manolache */ +#include jk_global.h #include jk_vm.h #include jk_config.h @@ -94,6 +95,22 @@ #include jni.h +#ifndef JNI_VERSION_1_2 + +#warning --- +#warning JAVA 1.1 IS NO LONGER SUPPORTED +#warning --- + +int jk2_vm_factory(jk_env_t *env, jk_pool_t *pool, + jk_bean_t *result, + char *type, char *name) +{ +return JK_FALSE; +} + +#else + + #ifndef JNI_VERSION_1_1 #define JNI_VERSION_1_1 0x00010001 #endif @@ -112,13 +129,8 @@ #define null_check(e) if ((e) == 0) return JK_FALSE - -static int jk2_open_jvm1(jk_env_t *env, jk_vm_t *p); - -#ifdef JNI_VERSION_1_2 static int jk2_detect_jvm_version(jk_env_t *env); static int jk2_open_jvm2(jk_env_t *env, jk_vm_t *p); -#endif jint (JNICALL *jni_get_default_java_vm_init_args)(void *) = NULL; jint (JNICALL *jni_create_java_vm)(JavaVM **, JNIEnv **, void *) = NULL; @@ -127,18 +139,9 @@ /* Guessing - try all those to find the right dll */ static const char *defaultVM_PATH[]={ -$(JAVA_HOME)$(fs)jre$(fs)bin$(fs)classic$(fs)libjvm.$(so), -$(JAVA_HOME)$(fs)jre$(fs)lib$(fs)$(arch)$(fs)classic$(fs)libjvm.$(so), -$(JAVA_HOME)$(fs)jre$(fs)bin$(fs)classic$(fs)jvm.$(so), -NULL -}; - -/** Where to try to find jk jars ( if user doesn't specify it explicitely ) */ -static const char *defaultJK_PATH[]={ -$(tomcat.home)$(fs)modules$(fs)jk$(fs)WEB-INF$(fs)lib$(fs)tomcat-jk2.jar, - $(tomcat.home)$(fs)modules$(fs)jk$(fs)WEB-INF$(fs)lib$(fs)tomcat-utils.jar, -$(tomcat.home)$(fs)webapps(fs)jk$(fs)WEB-INF$(fs)lib$(fs)tomcat-jk2.jar, - $(tomcat.home)$(fs)webapps(fs)jk$(fs)WEB-INF$(fs)lib$(fs)tomcat-utils.jar, +${JAVA_HOME}${fs}jre${fs}bin${fs}classic${fs}libjvm.${so}, +${JAVA_HOME}${fs}jre${fs}lib${fs}${arch}${fs}classic${fs}libjvm.${so}, +${JAVA_HOME}${fs}jre${fs}bin${fs}classic${fs}jvm.${so}, NULL }; @@ -169,11 +172,14 @@ #endif - -int jk2_vm_loadJvm(jk_env_t *env, jk_vm_t *p) +/** Load the VM. Must be called after init. + */ +static int jk2_vm_loadJvm(jk_env_t *env, jk_vm_t *jkvm) { + + #ifdef WIN32 -HINSTANCE hInst = LoadLibrary(p-jvm_dll_path); +HINSTANCE hInst = LoadLibrary(jkvm-jvm_dll_path); if(hInst) { (FARPROC)jni_create_java_vm = GetProcAddress(hInst, JNI_CreateJavaVM); @@ -195,6 +201,7 @@ FreeLibrary(hInst); } +return JK_TRUE; #elif defined(NETWARE) int javaNlmHandle = FindNLMHandle(JVM); if (0 == javaNlmHandle) { @@ -222,11 +229,11 @@ return JK_TRUE; #else void *handle; -handle = dlopen(p-jvm_dll_path, RTLD_NOW | RTLD_GLOBAL); +handle = dlopen(jkvm-jvm_dll_path, RTLD_NOW | RTLD_GLOBAL); if(handle == NULL ) { env-l-jkLog(env, env-l, JK_LOG_EMERG, - Can't load native library %s : %s\n, p-jvm_dll_path, + Can't load native library %s : %s\n, jkvm-jvm_dll_path, dlerror()); return JK_FALSE; } @@ -242,26 +249,27 @@ { env-l-jkLog(env, env-l, JK_LOG_EMERG, jni.loadJvm() Can't resolve symbols %s\n, - p-jvm_dll_path ); + jkvm-jvm_dll_path ); dlclose(handle); return JK_FALSE; } /* env-l-jkLog(env, env-l, JK_LOG_INFO, */ /* jni.loadJvm() %s symbols resolved\n, - p-jvm_dll_path); */ + jkvm-jvm_dll_path); */ return JK_TRUE; #endif } -void *jk2_vm_attach(jk_env_t *env, jk_vm_t *p) +static void
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c jk_worker_jni.c
costin 02/03/18 10:45:25 Modified:jk/native2/common jk_vm_default.c jk_worker_jni.c Log: Update to the new config mechanism. Revision ChangesPath 1.6 +55 -48jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- jk_vm_default.c 11 Mar 2002 11:41:11 - 1.5 +++ jk_vm_default.c 18 Mar 2002 18:45:25 - 1.6 @@ -75,6 +75,8 @@ */ #include jk_vm.h +#include jk_config.h + #if !defined(WIN32) !defined(NETWARE) #include dlfcn.h @@ -325,27 +327,18 @@ than we do ). */ char* jk2_vm_guessJvmDll(jk_env_t *env, jk_map_t *props, - jk_vm_t *jniw, char *prefix) + jk_vm_t *jniw) { char *jvm; jk_pool_t *p=props-pool; const char **current=defaultVM_PATH; char *libp; -/* Maybe he knows more */ -jvm =jk2_map_getStrProp( env, props, NULL, prefix, -jvm_lib, NULL ); -if( jvm!=NULL jk2_file_exists(env, jvm)) { -env-l-jkLog(env, env-l, JK_LOG_INFO, - jni.guessJvmDll() - user specified %s\n, jvm); -return jvm; -} - /* We need at least JAVA_HOME ( either env or in settings ) */ while( *current != NULL ) { -jvm = jk2_map_replaceProperties(env, props, p, - (char *)p-pstrdup( env, p, *current ) ); +jvm = jk2_config_replaceProperties(env, props, p, + (char *)p-pstrdup( env, p, *current ) ); if( jvm!=NULL jk2_file_exists(env, jvm)) { env-l-jkLog(env, env-l, JK_LOG_INFO, @@ -683,7 +676,7 @@ jk2_guessTomcatHome( env, props ); while( *current != NULL ) { -jkJar = jk2_map_replaceProperties(env, props, p, +jkJar = jk2_config_replaceProperties(env, props, p, (char *)p-pstrdup( env, p, *current )); if( jkJar!=NULL jk2_file_exists(env, jkJar)) { @@ -703,21 +696,49 @@ return NULL; } +static int +jk2_jk_vm_setProperty(jk_env_t *env, jk_bean_t *mbean, char *name, void *valueP ) +{ +jk_vm_t *_this=mbean-object; +char *value=valueP; + +if( strcmp( name, mx )==0 ) { +/* atoi + K, M */ +_this-tomcat_mx = jk2_config_str2int(env, value); +} else if( strcmp( name, ms )==0 ) { +_this-tomcat_ms = jk2_config_str2int(env, value); +} else if( strcmp( name, class_path )==0 ) { +_this-tomcat_classpath=value; +} else if( strcmp( name, jvm_lib )==0 ) { +_this-jvm_dll_path=value; +} else if( strcmp( name, sysprops )==0 ) { +_this-sysprops = jk2_config_split( env, _this-pool, + value, *, NULL); +#ifdef JNI_VERSION_1_2 +} else if( strcmp( name, java2opts )==0 ) { + env-l-jkLog(env, env-l, JK_LOG_INFO, + jni.validate() java2opts %s\n, value); +_this-java2opts = jk2_config_split( env, _this-pool, + value, *, NULL); +} else if( strcmp( name, java2lax )==0 ) { +int int_config=atoi( value ); +_this-java2lax = int_config ? JK_TRUE : JK_FALSE; +#endif +} else { +return JK_FALSE; +} + +return JK_TRUE; +} /** Initialize the vm properties */ -int jk2_jk_vm_init(jk_env_t *env, jk_vm_t *_this, - jk_map_t *props, char *prefix) +int jk2_jk_vm_init(jk_env_t *env, jk_vm_t *_this) { char *str_config; int int_config; +jk_map_t *props=_this-properties; -_this-tomcat_mx= jk2_map_getIntProp( env, props, NULL, prefix, mx, 0 ); -_this-tomcat_ms= jk2_map_getIntProp( env, props, NULL, prefix, ms, 0 ); - -_this-tomcat_classpath= jk2_map_getStrProp( env, props, NULL, prefix, -class_path, NULL ); - if(_this-tomcat_classpath == NULL ) { _this-tomcat_classpath = jk2_guessClassPath( env, props ); } @@ -734,7 +755,10 @@ return JK_FALSE; } -_this-jvm_dll_path=jk2_vm_guessJvmDll( env, props, _this, prefix ); +if( _this-jvm_dll_path ==NULL || +! jk2_file_exists(env, _this-jvm_dll_path )) { +_this-jvm_dll_path=jk2_vm_guessJvmDll( env, props, _this ); +} if(!_this-jvm_dll_path ) { env-l-jkLog(env, env-l, JK_LOG_EMERG, @@ -744,32 +768,12 @@ env-l-jkLog(env, env-l, JK_LOG_INFO, Jni lib: %s\n,
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
hgomez 02/03/11 03:41:11 Modified:jk/native2/common jk_vm_default.c Log: PR: Back port correction to patch 6817 where RTLD_GLOBAL is used but could be missing (probably outdated OS) Revision ChangesPath 1.5 +12 -0 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- jk_vm_default.c 21 Feb 2002 11:13:23 - 1.4 +++ jk_vm_default.c 11 Mar 2002 11:41:11 - 1.5 @@ -96,6 +96,18 @@ #define JNI_VERSION_1_1 0x00010001 #endif +/* probably on an older system that doesn't support RTLD_NOW or RTLD_LAZY. + * The below define is a lie since we are really doing RTLD_LAZY since the + * system doesn't support RTLD_NOW. + */ +#ifndef RTLD_NOW +#define RTLD_NOW 1 +#endif + +#ifndef RTLD_GLOBAL +#define RTLD_GLOBAL 0 +#endif + #define null_check(e) if ((e) == 0) return JK_FALSE -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
costin 02/02/06 11:15:25 Modified:jk/native2/common jk_vm_default.c Log: Update the defaults for the current naming conventions. Revision ChangesPath 1.3 +7 -11 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- jk_vm_default.c 26 Jan 2002 07:10:30 - 1.2 +++ jk_vm_default.c 6 Feb 2002 19:15:25 - 1.3 @@ -121,9 +121,9 @@ /** Where to try to find jk jars ( if user doesn't specify it explicitely ) */ static const char *defaultJK_PATH[]={ -$(tomcat.home)$(fs)modules$(fs)jk$(fs)WEB-INF$(fs)lib$(fs)jk2.jar, +$(tomcat.home)$(fs)modules$(fs)jk$(fs)WEB-INF$(fs)lib$(fs)tomcat-jk2.jar, $(tomcat.home)$(fs)modules$(fs)jk$(fs)WEB-INF$(fs)lib$(fs)tomcat-utils.jar, -$(tomcat.home)$(fs)webapps(fs)jk$(fs)WEB-INF$(fs)lib$(fs)ajp.jar, +$(tomcat.home)$(fs)webapps(fs)jk$(fs)WEB-INF$(fs)lib$(fs)tomcat-jk2.jar, $(tomcat.home)$(fs)webapps(fs)jk$(fs)WEB-INF$(fs)lib$(fs)tomcat-utils.jar, NULL }; @@ -409,20 +409,16 @@ if(vm_args.classpath) { unsigned len = strlen(vm_args.classpath) + - strlen(p-tomcat_classpath) + - 3; +strlen(p-tomcat_classpath) + 3; char *tmp = p-pool-alloc(env, p-pool, len); -if(tmp) { -sprintf(tmp, %s%c%s, -p-tomcat_classpath, -PATH_SEPERATOR, -vm_args.classpath); -p-tomcat_classpath = tmp; -} else { +if(tmp==NULL) { env-l-jkLog(env, env-l, JK_LOG_EMERG, Fail- allocation error for classpath\n); return JK_FALSE; } +sprintf(tmp, %s%c%s, p-tomcat_classpath, +PATH_SEPERATOR, vm_args.classpath); +p-tomcat_classpath = tmp; } vm_args.classpath = p-tomcat_classpath; -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
costin 02/01/25 23:10:30 Modified:jk/native2/common jk_vm_default.c Log: Fixes, get it to work right. Revision ChangesPath 1.2 +9 -2 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jk_vm_default.c 12 Jan 2002 04:48:20 - 1.1 +++ jk_vm_default.c 26 Jan 2002 07:10:30 - 1.2 @@ -121,8 +121,10 @@ /** Where to try to find jk jars ( if user doesn't specify it explicitely ) */ static const char *defaultJK_PATH[]={ -$(tomcat.home)$(fs)modules$(fs)jk$(fs)WEB-INF$(fs)lib$(fs)ajp.jar, +$(tomcat.home)$(fs)modules$(fs)jk$(fs)WEB-INF$(fs)lib$(fs)jk2.jar, + $(tomcat.home)$(fs)modules$(fs)jk$(fs)WEB-INF$(fs)lib$(fs)tomcat-utils.jar, $(tomcat.home)$(fs)webapps(fs)jk$(fs)WEB-INF$(fs)lib$(fs)ajp.jar, + $(tomcat.home)$(fs)webapps(fs)jk$(fs)WEB-INF$(fs)lib$(fs)tomcat-utils.jar, NULL }; @@ -254,7 +256,7 @@ /* linux_signal_hack(); */ #endif -err= (*jvm)-GetEnv( jvm, (void **)rc, 0 ); +err= (*jvm)-GetEnv( jvm, (void **)rc, JNI_VERSION_1_2 ); if( err != 0 ) { env-l-jkLog(env, env-l, JK_LOG_INFO, vm.attach() GetEnv failed %d\n, err); @@ -654,6 +656,9 @@ return NULL; } +env-l-jkLog(env, env-l, JK_LOG_INFO, + jni.guessTomcatHome() %s\n, tomcat_home); + props-put(env, props, tomcat.home, props-pool-pstrdup( env, props-pool, tomcat_home ), NULL); @@ -666,6 +671,8 @@ char *jkJar; jk_pool_t *p=props-pool; const char **current=defaultJK_PATH; + +guessTomcatHome( env, props ); while( *current != NULL ) { jkJar = jk_map_replaceProperties(env, props, p, -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_vm_default.c
costin 02/01/11 20:48:20 Added: jk/native2/common jk_vm_default.c Log: This is the code extracted from jni worker. Few changes - we do now a lot of 'guessing' to avoid asking the user for things we can find for ourself. The defaults do work now fine - it required LD_LIBRARY_PATH to be set before starting apache ( that's required by jni ), and if you also set TOMCAT_HOME and JAVA_HOME ( that should be already set or easy to do ) jni will figure everything it needs. The old settings in worker.properties can be used to override the guessed values, but the nightmare of setting jni worker should be close to end. Revision ChangesPath 1.1 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c Index: jk_vm_default.c === /* = * * * * The Apache Software License, Version 1.1 * * * * Copyright (c) 1999-2001 The Apache Software Foundation. * * All rights reserved.* * * * = * * * * Redistribution and use in source and binary forms, with or without modi- * * fication, are permitted provided that the following conditions are met: * * * * 1. Redistributions of source code must retain the above copyright notice * *notice, this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above copyright * *notice, this list of conditions and the following disclaimer in the * *documentation and/or other materials provided with the distribution. * * * * 3. The end-user documentation included with the redistribution, if any, * *must include the following acknowlegement: * * * * This product includes software developed by the Apache Software * *Foundation http://www.apache.org/. * * * *Alternately, this acknowlegement may appear in the software itself, if * *and wherever such third-party acknowlegements normally appear. * * * * 4. The names The Jakarta Project, Jk, and Apache Software * *Foundation must not be used to endorse or promote products derived * *from this software without prior written permission. For written * *permission, please contact [EMAIL PROTECTED].* * * * 5. Products derived from this software may not be called Apache nor may * *Apache appear in their names without prior written permission of the * *Apache Software Foundation.* * * * THIS SOFTWARE IS PROVIDED AS IS AND ANY EXPRESSED OR IMPLIED WARRANTIES * * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * * THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY * * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * * POSSIBILITY OF SUCH DAMAGE. * * * * = * * * * This software