Thursday, November 2, 2017

Apache Portable Runtime and Apache Tomcat® Native Troubleshooting

This page is intended to be a guide to configure the APR library to be used by Tomcat.
In order to install the Apache Portable Runtime, follow the next steps:
  • Download the Apache Portable Runtime from here. For this tutorial, the apr-1.6.3.tar.gz file is used.
  • Untar the file, 
  • Go to apr-1.6.3 folder.
  • Execute: 
    • ./configure
    • sudo make
    • sudo make install
    For more information visit here.

In order to install the Apache Tomcat® Native software, follow the next steps:
  • Download the Apache Tomcat® Native software from here. For this tutorial, the tomcat-native-1.2.14-src.tar.gz file is used.
  • Untar the file, tar -zxf tomcat-native-1.2.14-src.tar.gz
  • Go to tomcat-native-1.2.14-src/native folder.
  • Execute: 
    • ./configure
    • sudo make
    • sudo make install
   For more information visit here.
The Apache Tomcat® Native software is installed.

If the Apache Tomcat® Native software configuration throws the following error:
checking OpenSSL library version >= 1.0.2...
Found OPENSSL_VERSION_NUMBER 0x1000105f (OpenSSL 1.0.1e 11 Feb 2013)
Require OPENSSL_VERSION_NUMBER 0x1000200f or greater (1.0.2)
Other steps must be made to install a valid Open SSL library version.

In order to install the OpenSSL library, follow the next steps:
  • Download the OpenSSL library from here. For this  tutorial, the openssl-1.0.2l.tar.gz file is used.
  • Untar the file, tar -zxf openssl-1.0.2l.tar.gz
  • Go to openssl-1.0.2l folder.
  • Execute:
  • ./config
  • edit Makefile by adding -fPIC flag to the CFLAG variable: CFLAG= -fPIC -DOPENSSL_THREADS  (...)
  • sudo make
  • sudo make install
For more information visit here.
After install the OpenSSL library, the Apache Tomcat® Native software can be installed by executing:
  • ./configure --with-ssl=/usr/local/ssl
  • sudo make
  • sudo make install
Now the APR library can be used by Tomcat. 

Solaris X86 installations.

Before the APR required installations, the Solaris OS must be updated with the following steps:

In order to install the Apache Portable Runtime, follow the next steps:
  • Download the Apache Portable Runtime from here. For this tutorial, the apr-1.6.3.tar.gz file is used.
  • Untar the file, 
  • Go to apr-1.6.3 folder.
  • Execute: 
    • ./configure "CFLAGS=-m64" "CXXFLAGS=-m64" "LDFLAGS=-m64"
    • sudo gmake
    • sudo gmake install
    For more information visit here.
In order to install the Apache Tomcat® Native software, follow the next steps:
  • Download the Apache Tomcat® Native software from here. For this tutorial, the tomcat-native-1.2.14-src.tar.gz file is used.
  • Untar the file, tar -zxf tomcat-native-1.2.14-src.tar.gz
  • Go to tomcat-native-1.2.14-src/native folder.
  • Execute: 
    • ./configure --with-apr=/usr/local/apr/ --with-java-home=/home/qa/jdk1.8.0_151  --with-ssl=/usr/local/ssl "CFLAGS=-m64" "CXXFLAGS=-m64" "LDFLAGS=-m64"
    • sudo gmake
    • sudo gmake install

Notes.
-fPIC flag
The -fPIC flag must be added to the CFLAG variable on the OpensSSL's Makefile in order to avoid the following error:
/usr/bin/ld: /usr/local/ssl//lib/libssl.a(s3_meth.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/ssl//lib/libssl.a: could not read symbols: Bad value
This error is thrown when the sudo make command is executed in order to build the Apache Tomcat® Native software.

wrong ELF class: ELFCLASS32

The Apache Portable Runtime built with the default configure script throws and exception when Tomcat is running with Java 8 x64:
The APR based Apache Tomcat Native library failed to load. The error reported was [/usr/local/apr/lib/libtcnative-1.so.0.2.14: ld.so.1: java: fatal: /usr/local/apr/lib/libtcnative-1.so.0.2.14: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)]
The flags "CFLAGS=-m64" "CXXFLAGS=-m64" "LDFLAGS=-m64" must be used on the ./configure scripts in order to run Tomcat with java 8 successfully.

No comments:

Post a Comment