Troubleshoot Linux under Tomcat because of the Tomcat native problem startup error __linux

Source: Internet
Author: User
Tags sendfile apache tomcat
Omact Service startup error log the following information: The APR based Apache Tomcat Native Library which allows optimal performance in production environments Wasn't found on the Java.library.path: $JAVA _home/jre/lib/amd64/server: $JAVA _home/jre/lib/amd64: $JAVA _home/jre/. /lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib
is due to lack of APR support:
Tomcat Native is a local API that uses APR to enhance Tomcat performance
Tomcat Native This project allows Tomcat to use Apache's APR package to handle both file and network IO operations to improve performance.
Here's a description of Tomcat's official website:

Tomcat can use the Apache portable Runtime to provide superior scalability, performance, and better integration with Nativ E Server technologies. The Apache portable Runtime is a highly portable library This is at the heart of Apache HTTP Server 2.x. APR has many , including access to advanced IO functionality (such as Sendfile, Epoll and OpenSSL), OS level functionality (Random numb Er generation, System status, etc), and native process handling (shared memory, NT pipes and Unix sockets).

Solution:

Install Apr-devel

#yum Install Apr-devel

Enter Tomcat installation directory

#cd $CATALINA _home/bin

Extract files to current directory

#tar ZXF tomcat-native.tar.gz

Access to the native source directory
#cd $CATALINA _home/bin/tomcat-native-1.1.27-src/jni/native

Configuring compilation Information
#./configure--with-apr=/usr/bin/apr-1-config--with-java-home= $JAVA _home--prefix= $CATALINA _home

Compile
Make && make install
Installation success is prompted as follows:
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/apr/lib

If you are ever happen to want to link against installed libraries
In a given directory, Libdir, your must either use Libtool, and
Specify the full pathname of the library, or use the '-llibdir '
Flag during linking and do at least one of the following:
-Add Libdir to the ' Ld_library_path ' environment variable
During execution
-Add Libdir to the ' Ld_run_path ' environment variable
During linking
-Use the '-WL,-RPATH-WL,LIBDIR ' linker flag
-Have your system administrator add Libdir to '/etc/ld.so.conf ' and any operating system documentation about shared Libra Ries for
More information, such as the LD (1) and ld.so (8) manual pages.


To add a configuration:

Create setenv.sh file under Tomcat installation directory bin:
Ld_library_path= $LD _library_path: $CATALINA _home/lib
Export Ld_library_path

View Log after Tomcat is started the APR has been loaded
2013-6-8 14:31:05 Org.apache.catalina.core.AprLifecycleListener Init
Info: Loaded Apr based Apache Tomcat Native library 1.1.23 using APR version 1.3.9.
2013-6-8 14:31:05 Org.apache.catalina.core.AprLifecycleListener Init
Info: APR Capabilities:ipv6 [true], sendfile [true], accept filters [FALSE], random [true].

If you still have an error, enter the. Libs/libs directory (here 32-bit and 64-bit are different)
Ls-al:

libtcnative-1.a

Libtcnative-1.la->. /libtcnative-1.la

Libtcnative-1.lai

libtcnative-1.so-> libtcnative-1.so.0.1.27

libtcnative-1.so.0-> libtcnative-1.so.0.1.27

libtcnative-1.so.0.1.27

There are several link files inside, put

libtcnative-1.a

Libtcnative-1.lai

libtcnative-1.so.0.1.27

And the file that the libtcnative-1.la link points to (the libtcnative-1.la of the previous level directory) is copied to the $JAVA_HOME/JRE/LIB/AMD64 (i386-32 bit system)/server.


If Windows under the error is a copy of several DLL files to Windows/system32, the Apache website has.

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.