DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38875>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38875

           Summary: Misleading error message when there are problems loading
                    APR libraries
           Product: Tomcat 5
           Version: 5.5.15
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


We recently rebuilt APR during an OS reinstall. After this, Tomcat failed to
load the tcnative libraries:

INFO: The Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path:
/x1/opt/tomcat-5.5/tomcat/bin/tomcat-native-1.1.2/jni/native/.libs

However the libraries were definitely present there.

Eventually I poked around in AprLifecycleListener.java, and found that the code
initializing the APR library:

try {
      String methodName = "initialize";
      Class paramTypes[] = new Class[1];
      paramTypes[0] = String.class;
      Object paramValues[] = new Object[1];
      paramValues[0] = null;
      Class clazz = Class.forName("org.apache.tomcat.jni.Library");
      Method method = clazz.getMethod(methodName, paramTypes);
      method.invoke(null, paramValues);
      major = clazz.getField("TCN_MAJOR_VERSION").getInt(null);
      minor = clazz.getField("TCN_MINOR_VERSION").getInt(null);
      patch = clazz.getField("TCN_PATCH_VERSION").getInt(null);
  } catch (Throwable t) {
      if (!log.isDebugEnabled()) {
          log.info(sm.getString("aprListener.aprInit",
                  System.getProperty("java.library.path")));
       ...

You see it catches a Throwable, and *assumes* it means the library isn't
present. In my case this was not so. When I added a log.error() to print the
Throwable, I got:


SEVERE: java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.apache.catalina.core.AprLifecycleListener.lifecycleEvent(AprLifecycleListener.java:80)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at
org.apache.catalina.core.StandardServer.initialize(StandardServer.java:766)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:503)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:523)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:247)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)
Caused by: java.lang.UnsatisfiedLinkError:
/x1/opt/tomcat-5.5/apache-tomcat-5.5.15/bin/tomcat-native-1.1.2/jni/native/.libs/libtcnative-1.so.0.2.2:
/usr/local/apr-install/1.2.2/lib/libapr-1.so.0: undefined symbol: sock_is_ipv6,
no libtcnative-1 in
java.library.path(/x1/opt/tomcat-5.5/tomcat/bin/tomcat-native-1.1.2/jni/native/.libs)
        at org.apache.tomcat.jni.Library.<init>(Library.java:55)
        at org.apache.tomcat.jni.Library.initialize(Library.java:156)
        ... 15 more


For the record, this is apparently a bug in APR 1.2.2 triggered when it is
compiled with --disable-ipv6.

It would be good if Tomcat could catch the specific exception thrown when the
file is not found, and print all others, like this.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to