Port r671153 and r671459 from tcnative branch 1.1.x
authorrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 3 Nov 2009 00:00:18 +0000 (00:00 +0000)
committerrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 3 Nov 2009 00:00:18 +0000 (00:00 +0000)
to Tomcat trunk:

Log the exception when the file we dlopen exists.
Otherwise errors like:
+++
java.lang.UnsatisfiedLinkError: /home/jfclere/jbossweb_trunk/output/build/bin/META-INF/lib/linux2/x64/libaprutil-1.so.0.2.8: libpq.so.3: cannot open shared object file: No such file or directory
+++
Can't be traced.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@832211 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/jni/Library.java

index d178c78..749df3f 100644 (file)
@@ -33,6 +33,7 @@ public final class Library {
     static private Library _instance = null;
 
     private Library()
+        throws Exception
     {
         boolean loaded = false;
         String err = "";
@@ -42,6 +43,16 @@ public final class Library {
                 loaded = true;
             }
             catch (Throwable e) {
+                String name = System.mapLibraryName(NAMES[i]);
+                String path = System.getProperty("java.library.path");
+                String sep = System.getProperty("path.separator");
+                String [] paths = path.split(sep);
+                for (int j=0; j<paths.length; j++) {
+                    java.io.File fd = new java.io.File(paths[j] , name);
+                    if (fd.exists()) {
+                        e.printStackTrace();
+                    }
+                }
                 if ( i > 0)
                     err += ", ";
                 err +=  e.getMessage();