cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/server JNIConnectionHandler.java
costin 01/08/25 18:55:21 Modified:src/share/org/apache/tomcat/modules/server JNIConnectionHandler.java Log: Better message - we didn't find the library in LD_LIB_PATH, but that's not a 'failure', since we can try to look it up in the default location. Revision ChangesPath 1.13 +2 -1 jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java Index: JNIConnectionHandler.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- JNIConnectionHandler.java 2001/08/24 01:15:18 1.12 +++ JNIConnectionHandler.java 2001/08/26 01:55:21 1.13 @@ -219,7 +219,8 @@ was loaded from the lib path); return; } catch(UnsatisfiedLinkError usl) { - System.err.println(Failed to loadLibrary() + lib); + System.err.println(loadLibrary( + lib + +) didn't find the library, try with full path); if( debug 0 ) usl.printStackTrace(); }
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/server JNIConnectionHandler.java JNIEndpoint.java
costin 01/08/23 18:15:18 Modified:src/share/org/apache/tomcat/modules/server JNIConnectionHandler.java JNIEndpoint.java Log: - remove the dependency between JNIEndpoint and JNIConnectionHandler. The reverse is ok ( JNIConnection handler depends on JNIEndpoint ), since JNIEndpoint is in the main classloader. - added an option to exit if the library can't be loaded. This is a serious configuration problem, similar with apache not beeing able to find a module, the behavior should be the same. - fix the name of the .so/.dll/.nlm file ( had an extra s ). Fix File.separator, use the constructed path. - fix the 'multiple start' problem. Revision ChangesPath 1.12 +19 -23 jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java Index: JNIConnectionHandler.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- JNIConnectionHandler.java 2001/08/16 00:26:14 1.11 +++ JNIConnectionHandler.java 2001/08/24 01:15:18 1.12 @@ -1,8 +1,4 @@ /* - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v 1.11 2001/08/16 00:26:14 costin Exp $ - * $Revision: 1.11 $ - * $Date: 2001/08/16 00:26:14 $ - * * * * The Apache Software License, Version 1.1 @@ -83,25 +79,15 @@ * * @author Gal Shachor [EMAIL PROTECTED] */ -public class JNIConnectionHandler extends BaseInterceptor { +public class JNIConnectionHandler extends BaseInterceptor implements JNIEndpoint.JniHandler { public JNIConnectionHandler() { } -// JNIEndpoint was called to start tomcat -// Hack used to set the handler in JNIEndpoint. -// This works - if we have problems we may take the time -// and implement a better mechanism -static JNIEndpoint ep; - -public static void setEndpoint(JNIEndpoint jniep) -{ -ep = jniep; -} - // Config boolean nativeLibLoaded=false; String lib; +boolean exitOnError=true; /** Location of the jni library */ @@ -109,14 +95,24 @@ this.lib=lib; } +public void setExitIfNoLib(boolean b) { + exitOnError=b; +} + +JNIEndpoint ep=null; + /** Called when the ContextManger is started */ public void engineInit(ContextManager cm) throws TomcatException { - if( ep==null ) return; + ep= JNIEndpoint.getEndpoint(); + if(ep==null ) return; super.engineInit( cm ); if(! nativeLibLoaded ) { initLibrary(); + if( ! nativeLibLoaded exitOnError) { + System.exit(2); + } } try { // notify the jni side that jni is set up corectly @@ -201,7 +197,7 @@ } if( lib==null ) { - lib=jni_connector.; + lib=jni_connect.; String os = System.getProperty(os.name).toLowerCase(); if(os.indexOf(windows)=0){ lib+=dll; @@ -232,23 +228,23 @@ if( ! libF.isAbsolute() ) { File f1=new File(cm.getInstallDir()); // XXX should it be libexec ??? - File f2=new File( f1, bin + File.pathSeparator + native ); + File f2=new File( f1, bin + File.separator + native ); libF=new File( f2, lib ); } if( ! libF.exists() ) { throw new TomcatException( Native library doesn't exist + libF ); } - + // Loading from the library path failed // Try to load assuming lib is a complete pathname. try { - System.load(lib); + System.load(libF.getAbsolutePath()); nativeLibLoaded=true; - System.out.println(Library + lib + loaded); + System.out.println(Library + libF.getAbsolutePath() + loaded); return; } catch(UnsatisfiedLinkError usl) { -System.err.println(Failed to load() + lib); +System.err.println(Failed to load() + libF.getAbsolutePath()); if( debug 0 ) usl.printStackTrace(); } 1.4 +38 -21 jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIEndpoint.java Index: JNIEndpoint.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIEndpoint.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- JNIEndpoint.java
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/server JNIConnectionHandler.java
costin 01/08/15 17:26:14 Modified:src/share/org/apache/tomcat/modules/server JNIConnectionHandler.java Log: Few fixes and usability enhancements to JNIConnectionHandler. The native library is loaded only if we're in native mode, the module is inactive otherwise. This allows us to keep it in uncommented in server.xml. ( just like Jdk12Interceptor - which detects if jdk1.2 is used ) Also, the module needs no parameter if the default location for the library is used ( i.e. TOMCAT_HOME/bin/native/jni_connector.[so,dll,nlm] ). The extension is computed based on os. A message is displayed if the file can't be found. Revision ChangesPath 1.11 +81 -56 jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java Index: JNIConnectionHandler.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- JNIConnectionHandler.java 2001/08/15 02:30:29 1.10 +++ JNIConnectionHandler.java 2001/08/16 00:26:14 1.11 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v 1.10 2001/08/15 02:30:29 mmanders Exp $ - * $Revision: 1.10 $ - * $Date: 2001/08/15 02:30:29 $ + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v 1.11 2001/08/16 00:26:14 costin Exp $ + * $Revision: 1.11 $ + * $Date: 2001/08/16 00:26:14 $ * * * @@ -88,75 +88,35 @@ public JNIConnectionHandler() { } -// Config -boolean nativeLibLoaded=false; - -/** Location of the jni library - */ -public void setNativeLibrary(String lib) { -// First try to load from the library path -try { -System.loadLibrary(lib); - nativeLibLoaded=true; -System.out.println(Library + lib + - was loaded from the lib path); -return; -} catch(UnsatisfiedLinkError usl) { -//usl.printStackTrace(); -System.err.println(Failed to loadLibrary() + lib); -} - -// Loading from the library path failed -// Try to load assuming lib is a complete pathname. -try { - System.load(lib); - nativeLibLoaded=true; - System.out.println(Library + lib + loaded); -return; -} catch(UnsatisfiedLinkError usl) { -System.err.println(Failed to load() + lib); -//usl.printStackTrace(); -} - -// OK, try to load from the default libexec -// directory. -// libexec directory = tomcat.home + / + libexec -File f = new File(System.getProperties().getProperty(tomcat.home), - libexec); - - String os=System.getProperty( os.name ).toLowerCase(); -if( os.indexOf(windows)= 0) { -f = new File(f, jni_connect.dll); -} else if ( os.indexOf(netware)= 0) { -f = new File(f, jni_conn.nlm); -} else { -f = new File(f, jni_connect.so); -} -System.load(f.toString()); - nativeLibLoaded=true; -System.out.println(Library + f.toString() + loaded); -} - -// hack for server startup - // JNIEndpoint was called to start tomcat // Hack used to set the handler in JNIEndpoint. // This works - if we have problems we may take the time // and implement a better mechanism static JNIEndpoint ep; -boolean running = true; public static void setEndpoint(JNIEndpoint jniep) { ep = jniep; } +// Config +boolean nativeLibLoaded=false; +String lib; + +/** Location of the jni library + */ +public void setNativeLibrary(String lib) { + this.lib=lib; +} + /** Called when the ContextManger is started */ public void engineInit(ContextManager cm) throws TomcatException { + if( ep==null ) return; super.engineInit( cm ); + if(! nativeLibLoaded ) { - throw new TomcatException(Missing connector native library name); + initLibrary(); } try { // notify the jni side that jni is set up corectly @@ -167,6 +127,7 @@ } public void engineShutdown(ContextManager cm) throws TomcatException { + if( ep==null ) return;
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/server JNIConnectionHandler.java
mmanders01/08/14 19:30:29 Modified:src/share/org/apache/tomcat/modules/server JNIConnectionHandler.java Log: Added check for NetWare to load appropriate library. Revision ChangesPath 1.10 +5 -3 jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java Index: JNIConnectionHandler.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- JNIConnectionHandler.java 2001/02/27 02:55:41 1.9 +++ JNIConnectionHandler.java 2001/08/15 02:30:29 1.10 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v 1.9 2001/02/27 02:55:41 costin Exp $ - * $Revision: 1.9 $ - * $Date: 2001/02/27 02:55:41 $ + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v 1.10 2001/08/15 02:30:29 mmanders Exp $ + * $Revision: 1.10 $ + * $Date: 2001/08/15 02:30:29 $ * * * @@ -127,6 +127,8 @@ String os=System.getProperty( os.name ).toLowerCase(); if( os.indexOf(windows)= 0) { f = new File(f, jni_connect.dll); +} else if ( os.indexOf(netware)= 0) { +f = new File(f, jni_conn.nlm); } else { f = new File(f, jni_connect.so); }
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/server JNIConnectionHandler.java Ajp12.java
costin 01/02/26 18:55:42 Modified:src/share/org/apache/tomcat/modules/server JNIConnectionHandler.java Ajp12.java Log: String-MessageBytes Revision ChangesPath 1.9 +5 -5 jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java Index: JNIConnectionHandler.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- JNIConnectionHandler.java 2001/02/07 07:01:27 1.8 +++ JNIConnectionHandler.java 2001/02/27 02:55:41 1.9 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v 1.8 2001/02/07 07:01:27 costin Exp $ - * $Revision: 1.8 $ - * $Date: 2001/02/07 07:01:27 $ + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/JNIConnectionHandler.java,v 1.9 2001/02/27 02:55:41 costin Exp $ + * $Revision: 1.9 $ + * $Date: 2001/02/27 02:55:41 $ * * * @@ -306,8 +306,8 @@ methodMB.setString( env[0] ); uriMB.setString( env[1] ); queryMB.setString( env[2] ); - remoteAddr = env[3]; - remoteHost = env[4]; + remoteAddrMB.setString( env[3] ); + remoteHostMB.setString( env[4] ); serverNameMB.setString( env[5] ); serverPort = Integer.parseInt(env[6]); authType= env[7]; 1.15 +2 -2 jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp12.java Index: Ajp12.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp12.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- Ajp12.java2001/02/25 18:00:34 1.14 +++ Ajp12.java2001/02/27 02:55:41 1.15 @@ -149,8 +149,8 @@ req.pathInfo().setString( readString(ajpin, null)); //Apache parsed path-translated XXX Bug in mod_jserv ! dummy = readString(ajpin, null); req.queryString().setString( readString(ajpin, null)); - req.setRemoteAddr(readString(ajpin, "")); - req.setRemoteHost( readString(ajpin, "")); + req.remoteAddr().setString(readString(ajpin, "")); + req.remoteHost().setString( readString(ajpin, "")); if (isTomcatAuthentication()) dummy=readString(ajpin, null); else req.setRemoteUser( readString(ajpin, null)); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]