Environments is not found on the Java.library.path solution _linux

Source: Internet
Author: User
Tags openssl openssl library openssl version tomcat apache tomcat

Tomcat startup information appears as follows:

Info: The APR based Apache Tomcat Native Library which allows optimal performance in production environments is not found O n the Java.library.path:XXXX

Cause Analysis:

Tomcat recommends using the Apache APR to better run Tomcat;

Introduction to Apache's APR

The purpose of the APR (Apache portable run-time Libraries,apache Portable runtime), like its name, is primarily to provide an underlying support interface library that can be used across multiple operating system platforms for upper-tier applications. In earlier versions of Apache, the application itself must be able to handle the details of the various operating system platforms and invoke different processing functions for different platforms.

With the further development of Apache, the Apache organization decided to separate these common functions and develop them into a new project. In this way, the development of APR is independent of Apache, Apache is only using Apr.

APR enables the processing of platform details to move down. For applications, they do not need to consider the platform at all, whether UNIX, Linux or Windows, the interfaces that the application executes are basically uniform. So for APR, portability and a unified upper layer interface are a key consideration. The first thing that Apr did not do was to merge all the code used in Apache into a common code base, but it was not the right strategy, so the APR changed its goal. Sometimes using public code is not a good thing, such as how to map a request to a thread or a process is platform-dependent, so a single common code base does not complete this distinction. Apr's goal is to securely merge all the code that can be merged without sacrificing performance.

One of the earliest goals of APR is to provide a common, unified operational interface for all platforms (not parts), which is a very remarkable goal and, of course, an unrealistic one. We cannot support all the features of all platforms, so APR currently offers all APR feature support for most platforms, including Win32, OS/2, BeOS, Darwin, Linux, and so on. To achieve this goal, APR developers must create a series of feature macros (FEATURE MACROS) to differentiate between platforms for features that cannot be run on all platforms. These feature macro definitions are very simple and are usually set with the Apr_has_feature parameter:

If a platform has this feature, the macro must be set to true, for example, Linux and windows have memory-mapped files, and APR provides an operational interface for memory-mapped files, so Apr_has_mmap macros must be set on these two platforms, while ap_mmap_* The function should map the disk file to memory and return the appropriate status code. If your operating system does not support memory mapping, then Apr_has_mmap must be set to 0, and all ap_mmap_* functions may not need to be defined. The second step is to warn about functions that are not supported in a program.

Workaround One:

Download the Tcnative-1.dll for your Tomcat version and put it in the Apache-tomcat-7.0.57\bin directory to restart Tomcat.

Download Address: http://archive.apache.org/dist/tomcat/tomcat-connectors/native/

If you do not know the version, you can download a version, put it in the directory, when you restart Tomcat, you will be prompted to the appropriate version of the Tcnative-1.dll.

1,

2.

3.

4.

Workaround Two,

This is a problem with APR, because Tomcat needs to rely on APR to optimize performance, and you need to install APR

1, the first installation of APR, using the source code installation, the default installation in:/USR/LOCAL/APR

wget http://mirrors.cnnic.cn/apache//apr/apr-1.5.2.tar.gz
TAR-ZXVF apr-1.5.0.tar.gz
CD apr-1.5.0
./configure
Make
Make install

2, the next installation tomcat-native, this GZ packet in Tomcat bin directory already exist, directly decompression tomcat-native;

Enter directory: CD tomcat-native-1.2.7-src/native, then compile the installation:

./configure--with-apr=/usr/local/apr--with-java-home= "/usr/lib/jvm/java-1.7.0"--with-ssl=yes

If the downloaded Tomcat version is newer, the OpenSSL version of the build installation appears to be inconsistent and cannot be installed with the following error:

Checking OpenSSL library version >= 1.0.2 ... Configure:error:Your version of OpenSSL is not compatible and this version of Tcnative

You need to download a lower version of the Tomcat-native package:

wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-connectors/native/1.1.34/source/tomcat-native-1.1.34-src.tar.gz

After downloading the above GZ package, put it down to Tomcat's Bin directory, unzip it, enter the directory: CD tomcat-native-1.1.20-src/jni/native, then compile the installation

3, after the successful compilation installation, in Tomcat's Bin directory, a new file named setenv.sh

Add content in new file:

Ld_library_path= $LD _library_path: $CATALINA _home/lib
Export Ld_library_path
4, after the above three steps, the first question can be resolved;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.