Using tcnative module on AIX for HTTP2 on Tomcat

2

Has anyone successfully got the HTTP/2 connector working in Tomcat9 on AIX (e.g. powerpc-ibm-aix7.2.5.0)?

I followed the instructions here to build the tcnative module (using tomcat-native-1.2.24-src that comes with Tomcat 9.0.37, APR 1.5.2, OpenSSL 1.0.2, IBM Java 1.8.0_261) i.e.

$ ./configure --with-apr=/opt/freeware/bin/apr-1-config --with-java-home=/app/java8_64/ --with-ssl=yes --prefix=/app/tomcat

followed by

make && make install

This creates the expected entries in /app/tomcat/lib, i.e.

-rw-r--r--    1 usrxxx grpxxxx       3440287 Mar 03 16:47 libtcnative-1.a
-rwxr-xr-x    1 usrxxx grpxxxx          1057 Mar 03 16:47 libtcnative-1.la
lrwxrwxrwx    1 usrxxx grpxxxx            23 Mar 03 16:47 libtcnative-1.so -> libtcnative-1.so.0.2.24
lrwxrwxrwx    1 usrxxx grpxxxx            23 Mar 03 16:47 libtcnative-1.so.0 -> libtcnative-1.so.0.2.24
-rwxr-xr-x    1 usrxxx grpxxxx       1372146 Mar 03 16:47 libtcnative-1.so.0.2.24

but when Tomcat starts I get

04-Mar-2021 15:30:00.752 WARNING [main] org.apache.catalina.core.AprLifecycleListener.init The Apache Tomcat Native library failed to load. The error reported was [tcnative-1 (Not found in java.library.path)]
java.lang.UnsatisfiedLinkError: tcnative-1 (Not found in java.library.path)
        at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1462)
        at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1414)
        at java.lang.System.loadLibrary(System.java:584)
        at org.apache.tomcat.jni.Library.<init>(Library.java:69)
        at org.apache.tomcat.jni.Library.initialize(Library.java:206)
        at org.apache.catalina.core.AprLifecycleListener.init(AprLifecycleListener.java:198)
...
04-Mar-2021 15:30:01.096 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.library.path=/app/java8_64/jre/lib/ppc64/compressedrefs:/app/java8_64/jre/lib/ppc64:/app/java8_64/jre/lib/ppc64/j9vm:/app/java8_64/jre/lib/ppc64:/app/java8_64/jre/../lib/ppc64:/app/java8_64/jre/lib/icc:/opt/freeware/lib:/opt/freeware/lib64:/usr/lib:/usr/lib64:/app/tomcat/lib:/usr/lib64:/usr/lib
...
04-Mar-2021 15:30:02.233 SEVERE [main] org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector[org.apache.coyote.http11.Http11AprProtocol-8443]] org.apache.catalina.LifecycleException: The configured protocol [org.apache.coyote.http11.Http11AprProtocol] requires the APR/native library which is not available
        at org.apache.catalina.connector.Connector.initInternal(Connector.java:1024)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:533)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1057)

Edit - based on suggestions from Piotr and Lorinczy:

Tried adding tcnative-1.so as a symlink - same error

Copied libtcnative-1.* to the bin folder. Still failing but new error (progress!?). Possible 32bit v 64bit issue?

09-Mar-2021 10:10:07.116 WARNING [main] org.apache.catalina.core.AprLifecycleListener.init The Apache Tomcat Native library failed to load. The error reported was [/app/apache-tomcat-9.0.37/bin/libtcnative-1.a (        0509-022 Cannot load module /app/apache-tomcat-9.0.37/bin/libtcnative-1.a.
        0509-026 System error: Cannot run a file that does not have a valid format.)]
java.lang.UnsatisfiedLinkError: /app/apache-tomcat-9.0.37/bin/libtcnative-1.a (   0509-022 Cannot load module /app/apache-tomcat-9.0.37/bin/libtcnative-1.a.
        0509-026 System error: Cannot run a file that does not have a valid format.)
        at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1462)
    ...

All the dependencies seem to be available

$ldd libtcnative-1.so.0.2.24
libtcnative-1.so.0.2.24 needs:
         /usr/lib/libssl.so
         /usr/lib/libcrypto.so
         /opt/freeware/lib/libapr-1.so
         /usr/lib/libpthread.a(shr_xpg5.o)
         /usr/lib/libc.a(shr.o)
         /opt/freeware/lib/libgcc_s.a(shr.o)
         /usr/lib/libcrypto.a(libcrypto.so.1.0.2)
         /unix
         /usr/lib/libpthreads.a(shr_comm.o)
         /usr/lib/libcrypt.a(shr.o)

but the dump command seems to support the 32 v 64 bit theory:

$ dump -H -X64 libtcnative-1.so.0.2.24

libtcnative-1.so.0.2.24:
dump: libtcnative-1.so.0.2.24: 0654-108 file is not valid in the current object file mode.
        Use the -X option to specify the desired object mode.
$ dump -H -X32 libtcnative-1.so.0.2.24

libtcnative-1.so.0.2.24:

                        ***Loader Section***
                      Loader Header Information
VERSION#         #SYMtableENT     #RELOCent        LENidSTR
0x00000001       0x00000364       0x00000771       0x00000084

#IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
0x00000007       0x0000aacc       0x00006406       0x0000ab50


                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER
0      /opt/freeware/lib:/usr/lib:/lib
1                                    libssl.so
2                                    libcrypto.so
3                                    libapr-1.so
4                                    libpthread.a        shr_xpg5.o
5                                    libc.a              shr.o
6                                    libgcc_s.a          shr.o

It looks like only the 32-bit version of APR is currently available on the server also. I will update once I can get the 64-bit version installed.

Further Updates

The commands I am trying now are:

$ export CFLAGS=-maix64
$ export OBJECT_MODE=64
$ ./configure --with-apr=/opt/freeware/bin/apr-1-config_64 --with-java-home=/app/java8_64/ --with-ssl=/usr/include/openssl --prefix=/app/tomcat
$ make && make install

No errors but same outcome however. This doesn't seem to build a 64 bit version of the tomcat native module (if that is the issue).

java
tomcat
aix
http2
asked on Stack Overflow Mar 5, 2021 by GBC • edited Apr 9, 2021 by GBC

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0