Index: java/org/apache/catalina/core/AprLifecycleListener.java =================================================================== --- java/org/apache/catalina/core/AprLifecycleListener.java (revision 1658926) +++ java/org/apache/catalina/core/AprLifecycleListener.java (working copy) @@ -29,6 +29,7 @@ import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.jni.Library; +import org.apache.tomcat.jni.LibraryNotFoundError; import org.apache.tomcat.jni.SSL; import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.res.StringManager; @@ -208,8 +209,24 @@ } catch (Throwable t) { t = ExceptionUtils.unwrapInvocationTargetException(t); ExceptionUtils.handleThrowable(t); - initInfoLogMessages.add(sm.getString("aprListener.aprInit", - System.getProperty("java.library.path"))); + + if(t instanceof LibraryNotFoundError){ + log.warn(sm.getString("aprListener.aprNotFound", ((LibraryNotFoundError) t).getName(), System.getProperty("java.library.path"))); + if(log.isDebugEnabled()) { + log.error(sm.getString("aprListener.aprNotFound", ((LibraryNotFoundError) t).getName(), System.getProperty("java.library.path")), t); + } + } + else if(t instanceof UnsatisfiedLinkError){ + log.warn(sm.getString("aprListener.aprFailedToLoad", System.getProperty("java.library.path"))); + if(log.isDebugEnabled()) { + log.error(sm.getString("aprListener.aprFailedToLoad", System.getProperty("java.library.path")), t); + } + } + else{ + initInfoLogMessages.add(sm.getString("aprListener.aprInit", + System.getProperty("java.library.path"))); + } + return; } if (apver < rqver) { Index: java/org/apache/catalina/core/LocalStrings.properties =================================================================== --- java/org/apache/catalina/core/LocalStrings.properties (revision 1658926) +++ java/org/apache/catalina/core/LocalStrings.properties (working copy) @@ -51,6 +51,8 @@ applicationServletRegistration.setServletSecurity.ise=Security constraints can't be added to servlet [{0}] deployed to context with name [{1}] as the context has already been initialised applicationSessionCookieConfig.ise=Property {0} can not be added to SessionCookieConfig for context {1} as the context has been initialised aprListener.aprInit=The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: {0} +aprListener.aprNotFound=The APR based Apache Tomcat Native library {0} which allows optimal performance in production environments was not found on the java.library.path: {1} +aprListener.aprFailedToLoad=Failed to load The APR based Apache Tomcat Native library which allows optimal performance in production environments aprListener.tcnInvalid=An incompatible version {0} of the APR based Apache Tomcat Native library is installed, while Tomcat requires version {1} aprListener.tcnVersion=An older version {0} of the APR based Apache Tomcat Native library is installed, while Tomcat recommends a minimum version of {1} aprListener.aprDestroy=Failed shutdown of APR based Apache Tomcat Native library Index: java/org/apache/tomcat/jni/Library.java =================================================================== --- java/org/apache/tomcat/jni/Library.java (revision 1658926) +++ java/org/apache/tomcat/jni/Library.java (working copy) @@ -18,6 +18,7 @@ package org.apache.tomcat.jni; import java.io.File; +import java.io.FileNotFoundException; /** Library * @@ -49,22 +50,37 @@ if (t instanceof VirtualMachineError) { throw (VirtualMachineError) t; } + String name = System.mapLibraryName(NAMES[i]); String path = System.getProperty("java.library.path"); String [] paths = path.split(File.pathSeparator); for (int j=0; j 0) + + err.append(t.getMessage()); + err.append('('); + err.append(System.getProperty("java.library.path")); + err.append(')'); + throw new LibraryNotFoundError(name, err.toString()); + + //Commenetd as part of fix + /* if ( i > 0) err.append(", "); - err.append(t.getMessage()); + err.append(t.getMessage());*/ } if (loaded) break; } + + if (!loaded) { err.append('('); err.append(System.getProperty("java.library.path")); Index: java/org/apache/tomcat/jni/LibraryNotFoundError.java =================================================================== --- java/org/apache/tomcat/jni/LibraryNotFoundError.java (revision 0) +++ java/org/apache/tomcat/jni/LibraryNotFoundError.java (working copy) @@ -0,0 +1,16 @@ +package org.apache.tomcat.jni; + +public class LibraryNotFoundError extends UnsatisfiedLinkError{ + + String nameOfTheLibrary = null; + public LibraryNotFoundError(String name, String errorMessage){ + super(errorMessage); + nameOfTheLibrary = name; + + } + + public String getName(){ + return nameOfTheLibrary; + } + +}