How to resolve HTTPS connection error in Docker container

How to resolve HTTPS connection error in Docker container

book

Article ID: KB0071959

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -

Description

In a Docker container when using HTTPS SSL configuration , below errors are seen in the TIBCO BusinessEvents application container start-up logs

Error Logs :
#####
org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /lib:/lib:/opt/tibco/as/2.2/lib:/opt/tibco/tibcojre64/1.8.0/lib/amd64/server:/opt/tibco/tibcojre64/1.8.0/lib/amd64:/lib:/clients/java:/lib/x86_64::/opt/tibco/be/ext:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
org.apache.catalina.core.StandardService initInternal
SEVERE: Failed to initialize connector [Connector[HTTP/1.1-443]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-443]]
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:560)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:840)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:135)
        at org.apache.catalina.startup.Tomcat.start(Tomcat.java:372)
        at com.tibco.cep.driver.http.server.impl.TomcatServer$1.run(SourceFile:820)
        at java.lang.Thread.run(Thread.java:748)
Caused by: 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:972)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        ... 8 more

##########

Note: Using non-SSL HTTP channel , the TIBCO BusinessEvents application container starts up successfully without issues.


Cause:

The exception was a result of missing tomcat-native library.
The library referred to is bundled into an OS specific dll (tcnative-1.dll) loaded via JNI.

 

Issue/Introduction

How to resolve HTTPS connection error in Docker container

Environment

All Operating systems

Resolution

Here are the configuration steps needed to resolve the issue:

Windows platform:
--------------------
1. Download the "tcnative-1.dll" library from Apache Tomcat website.
For example, you can download from the following url:
http://tomcat.apache.org/download-native.cgi
2. Copy the "tcnative-1.dll" to <TIBCO_HOME>\tibcojre64\<version>\lib directory.


Linux platform:
------------------
1. Install Apache Portable Runtime (APR) and OpenSSL (if not already installed
on the system).
1.1 For Dedian based Linux, execute the following command:
- apt-get install build-essential libapr1-dev libssl-dev
 
1.2 For Redhat Linux, perform the following steps:
 
1.2.1 Download the source for APR from
http://apr.apache.org/download.cgi (download the .tar.gz file)

1.2.2 Execute the following command to extract the package:
tar xvzf apr-1.5.0.tar.gz

1.2.3 Execute following commands at the command prompt in sequence:
cd apr-1.5.0
./configure
make
make install

Note: Note down the path shown at the end of "make install" command. The
directory at this path should contain"apr-1-config". The "apr-1-config"
is required while building tomcat native library as mentioned in
"Build Tomcat native library" section.

2. Build Tomcat native library
2.1 Download the "tomcat-native.tar.gz" archive to a temporary location such as,
"/home/user/tomnative". The "tomcat-native.tar.gz" archive is located under
$CATALINA_HOME/bin.
2.2 Navigate to the temporary location directory "/home/user/tomnative".
2.3 Extract the "tomcat-native.tar.gz" archive in the "/home/user/tomnative" location.
2.4 Change to the "/home/user/tomnative/tomcat-native-1.1.27-src/ini/native" directory.
2.5 Execute following commands at the command prompt in sequence:
2.5.1 ./configure -with-apr=</usr/bin/apr-1-config>
-with-java-home=</usr/tools/jdk_1.7.0_45>
-with-ssl=yes -prefix=<path to destination directory>

where <path to destination directory> is the directory where the libraries are
created. Modify the full path to "apr-1-config" (as specified with -with-apr argument)
and the full path to JDK (as specified with -with-java-home parameter) as per your
system setup.
2.5.2 make
2.5.3 make install
Note: Verify that the destination directory contains around 5 new files with extensions
such as .so, .la,.a etc after the successful installation.

3. Set up the LIBRARY PATH
3.1 Navigate to the <BE_HOME>/bin/directory where BE_HOME is your TIBCO BusinessEvents installation directory. For instance if BE version "x.y" was installed under /opt/tibco, then BE_HOME will be the directory /opt/tibco/be/x.y .
3.2 Edit the be-engine.tra file.
3.3 Set the LD_LIBRARY_PATH to the destination directory where the libraries were created.
The destination directory is indicated by the -prefix parameter as specified
in 2.5.1 step. Set the library path as below:

LD_LIBRARY_PATH=<path to destination directory>
export LD_LIBRARY_PATH
3.4 Save the be-engine.tra file.

Set the LD_LIBRARY_PATH globally in your environment settings or edit the Dockerfile as follows to update the LD_LIBRARY_PATH
###
ENV LD_LIBRARY_PATH="<path to destination directory>:${LD_LIBRARY_PATH}"
###

 

Additional Information

http://tomcat.apache.org/native-doc/
https://docs.docker.com/engine/reference/builder/#environment-replacement
https://github.com/docker-library/tomcat/issues/7