Author: jfrederic.clere(a)jboss.com
Date: 2011-12-15 04:17:25 -0500 (Thu, 15 Dec 2011)
New Revision: 1891
Modified:
trunk/java/org/apache/tomcat/jni/Library.properties
trunk/java/org/apache/tomcat/jni/LibraryLoader.java
Log:
Fix for AS7-2695.
Modified: trunk/java/org/apache/tomcat/jni/Library.properties
===================================================================
--- trunk/java/org/apache/tomcat/jni/Library.properties 2011-12-15 07:29:10 UTC (rev
1890)
+++ trunk/java/org/apache/tomcat/jni/Library.properties 2011-12-15 09:17:25 UTC (rev
1891)
@@ -1,4 +1,4 @@
-# Copyright(c) 2007 Red Hat Middleware, LLC,
+# Copyright(c) 2011 Red Hat Middleware, LLC,
# and individual contributors as indicated by the @authors tag.
# See the copyright.txt in the distribution for a
# full listing of individual contributors.
@@ -19,49 +19,37 @@
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
#
# @author Mladen Turk
+# @author Jean-Frederic Clere
#
# Library.properties
#
-windows.count=6
+windows.count=1
windows.0=*tcnative-1.dll
-windows.1=libapr-1.dll
-windows.2=libaprutil-1.dll
-windows.3=?libeay32.dll
-windows.4=?ssleay32.dll
-windows.5=libtcnative-1.dll
-linux2.count=7
-linux2.0=libapr-1.so
-linux2.1=?libexpat.so
-linux2.2=?libaprutil-1.so
-linux2.3=?libz.so
-linux2.4=?libcrypto.so
-linux2.5=?libssl.so
-linux2.6=libtcnative-1.so
+linux2.count=5
+linux2.0=apr-1
+linux2.1=?libz
+linux2.2=?crypto
+linux2.3=?ssl
+linux2.4=tcnative-1
-solaris.count=7
-solaris.0=libapr-1.so
-solaris.1=?libexpat.so
-solaris.2=?libaprutil-1.so
-solaris.3=?libz.so
-solaris.4=?libcrypto.so
-solaris.5=?libssl.so
-solaris.6=libtcnative-1.so
+solaris.count=5
+solaris.0=apr-1
+solaris.1=?z
+solaris.2=?crypto
+solaris.3=?ssl
+solaris.4=tcnative-1
-hpux.count=7
-hpux.0=libapr-1.sl
-hpux.1=?libexpat.sl
-hpux.2=?libaprutil-1.sl
-hpux.3=?libz.sl
-hpux.4=?libcrypto.sl
-hpux.5=?libssl.sl
-hpux.6=libtcnative-1.sl
+hpux.count=5
+hpux.0=apr-1
+hpux.1=?z
+hpux.2=?crypto
+hpux.3=?ssl
+hpux.4=tcnative-1
-macosx.count=7
-macosx.0=libapr-1.dylib
-macosx.1=?libexpat.dylib
-macosx.2=?libaprutil-1.dylib
-macosx.3=?libz.dylib
-macosx.4=?libcrypto.dylib
-macosx.5=?libssl.dylib
-macosx.6=libtcnative-1.dylib
+macosx.count=5
+macosx.0=apr-1
+macosx.1=?z
+macosx.2=?crypto
+macosx.3=?ssl
+macosx.4=tcnative-1
Modified: trunk/java/org/apache/tomcat/jni/LibraryLoader.java
===================================================================
--- trunk/java/org/apache/tomcat/jni/LibraryLoader.java 2011-12-15 07:29:10 UTC (rev
1890)
+++ trunk/java/org/apache/tomcat/jni/LibraryLoader.java 2011-12-15 09:17:25 UTC (rev
1891)
@@ -29,8 +29,11 @@
import java.io.InputStream;
import java.util.Properties;
+import org.jboss.logging.Logger;
+
public final class LibraryLoader {
+ private static Logger log =
Logger.getLogger(org.apache.catalina.core.AprLifecycleListener.class);
public static String getDefaultPlatformName()
{
@@ -57,61 +60,6 @@
return platform;
}
- public static String getDefaultPlatformNameVersion()
- {
- String platform = getDefaultPlatformName();
-
-
- if (platform.equals("solaris")) {
- // Add the version...
- String version = System.getProperty("os.version");
- if (version.equals("5.10"))
- platform = "solaris10";
- else if (version.equals("5.9"))
- platform = "solaris9";
- else
- platform = "solaris11";
- }
-
- return platform;
- }
-
- public static String getDefaultPlatformCpu()
- {
- String cpu;
- String arch = System.getProperty("os.arch");
-
- if (arch.endsWith("86"))
- cpu = "x86";
- else if (arch.startsWith("PA_RISC")) {
- if (arch.endsWith("W"))
- cpu = "parisc2W";
- else
- cpu = "parisc2";
- } else if (arch.startsWith("IA64"))
- cpu = "i64";
- else if (arch.equals("x86_64"))
- cpu = "x64";
- else if (arch.equals("amd64"))
- cpu = "x64";
- else
- cpu = arch;
- return cpu;
- }
-
- public static String getDefaultLibraryPath()
- {
- String name = getDefaultPlatformNameVersion();
- String arch = getDefaultPlatformCpu();
-
- return name + File.separator + arch;
- }
-
- public static String getDefaultMetaPath()
- {
- return "META-INF" + File.separator + "lib" + File.separator;
- }
-
private LibraryLoader()
{
// Disallow creation
@@ -122,23 +70,8 @@
{
int count = 0;
String name = getDefaultPlatformName();
- String path = getDefaultLibraryPath();
Properties props = new Properties();
- File root = new File(rootPath);
- String basePath = root.getCanonicalPath().toString();
- if (!basePath.endsWith(File.separator)) {
- basePath += File.separator;
- }
- String metaPath = basePath + getDefaultMetaPath();
- File meta = new File(metaPath);
- if (!meta.exists()) {
- /* Try adding bin prefix to rootPath.
- * Used if we pass catalina.base property
- */
- metaPath = basePath + "bin" + File.separator +
- getDefaultMetaPath();
- }
try {
InputStream is = LibraryLoader.class.getResourceAsStream
("/org/apache/tomcat/jni/Library.properties");
@@ -162,23 +95,19 @@
dlibName = dlibName.substring(1);
full = true;
}
- String fullPath = metaPath + path +
- File.separator + dlibName;
+
+ /* AS7 jboss-modules takes care of the names */
try {
- Runtime.getRuntime().load(fullPath);
+ System.loadLibrary(dlibName);
+ log.debug("Loaded: " + dlibName);
+ } catch (Throwable d) {
+ log.debug("Loading " + dlibName + " throws: " + d);
+ if (optional)
+ continue;
+ throw new UnsatisfiedLinkError(" Error: " + d.getMessage() +
" " );
}
- catch (Throwable d) {
- if (!optional) {
- java.io.File fd = new java.io.File(fullPath);
- if (fd.exists()) {
- throw new UnsatisfiedLinkError(" Error: " +
d.getMessage() + " " );
- } else {
- throw new UnsatisfiedLinkError(" Can't find: " +
fullPath + " ");
- }
- }
- }
if (full)
- break;
+ break;
}
}
Show replies by date