program tip

"APR 기반 Apache Tomcat 네이티브 라이브러리를 찾을 수 없음"은 무엇을 의미합니까?

radiobox 2020. 9. 5. 09:38
반응형

"APR 기반 Apache Tomcat 네이티브 라이브러리를 찾을 수 없음"은 무엇을 의미합니까?


Windows의 Eclipse에서 Tomcat 7을 사용하고 있습니다. Tomcat을 시작할 때 다음 정보 메시지가 나타납니다.

프로덕션 환경에서 최적의 성능을 제공하는 APR 기반 Apache Tomcat 네이티브 라이브러리는 java.library.path에서 찾을 수 없습니다.

이것은 무엇을 의미하며 어떻게 APR 라이브러리를 제공 할 수 있습니까?


"프로덕션 환경에서 최적의 성능을 제공하는 APR 기반 Apache Tomcat 네이티브 라이브러리는 java.library.path에서 찾을 수 없습니다."

참조 된 라이브러리는 JNI를 통해로드 된 OS 특정 dll (tcnative-1.dll)에 번들로 제공됩니다. 이를 통해 tomcat은 Java 런타임에서 제공되지 않는 OS 기능 (예 : sendfile, epoll, OpenSSL, 시스템 상태 등)을 사용할 수 있습니다. Tomcat 없이도 잘 실행되지만 일부 사용 사례의 경우 기본 라이브러리를 사용하면 더 빠릅니다.

정말로 원한다면 tcnative-1.dll(또는 libtcnative.soLinux의 경우) 다운로드하여 bin 폴더에 넣고 eclipse에서 tomcat 서버의 시작 구성에 시스템 속성을 추가하십시오.

 -Djava.library.path=c:\dev\tomcat\bin

프로덕션 서버를 실행하지 않는 한이 메시지에 대해 걱정하지 마십시오. 이것은 성능을 향상시키는 데 사용되는 라이브러리입니다 (프로덕션 시스템에서). 에서 아파치 휴대용 런타임 APR () 톰캣 네이티브 라이브러리를 기반으로 :

Tomcat은 Apache Portable Runtime을 사용하여 뛰어난 확장 성, 성능 및 기본 서버 기술과의 더 나은 통합을 제공 할 수 있습니다. Apache Portable Runtime은 Apache HTTP Server 2.x의 핵심 인 이식성이 뛰어난 라이브러리입니다. APR은 고급 IO 기능 (예 : sendfile, epoll 및 OpenSSL), OS 레벨 기능 (임의 번호 생성, 시스템 상태 등) 및 기본 프로세스 처리 (공유 메모리, NT 파이프 및 Unix 소켓)에 대한 액세스를 포함하여 많은 용도로 사용됩니다.


RHEL Linux에서 다음을 실행하십시오.

yum install tomcat-native.x86_64

/ 참고 : 아키텍처에 따라 64 비트 또는 32 비트 패키지는 다른 확장을 가질 수 있습니다 /

그게 다입니다. 그 후 로그 파일에서 다음 정보 메시지를 찾을 수 있습니다.

INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].

모든 작업이 이전보다 눈에 띄게 빨라질 것입니다.


다음을 사용하여 Ubuntu 서버에 네이티브 라이브러리를 설치합니다.

sudo apt-get install libtcnative-1

작동하지 않으면 tomcat-native를 설치해야합니다.

  1. Oracle java7을 설치합니다.

    • sudo add-apt-repository ppa : webupd8team / java
    • sudo apt-get 업데이트
    • sudo apt-get install oracle-java7-installer
    • sudo apt-get install oracle-java7-set-default
  2. tomcat apr 설치 :

  3. tomcat tomcat-native를 설치합니다.


I just went through this and configured it with the following:

Ubuntu 16.04

Tomcat 8.5.9

Apache2.4.25

APR 1.5.2

Tomcat-native 1.2.10

Java 8

These are the steps i used based on the older posts here:

Install package

sudo apt-get update
sudo apt-get install libtcnative-1

Verify these packages are installed

sudo apt-get install make 
sudo apt-get install gcc
sudo apt-get install openssl

Install package

sudo apt-get install libssl-dev

Install and compile Apache APR

cd /opt/tomcat/bin
sudo wget http://apache.mirror.anlx.net//apr/apr-1.5.2.tar.gz
sudo tar -xzvf apr-1.5.2.tar.gz
cd apr-1.5.2
sudo ./configure
sudo make
sudo make install

verify installation

cd /usr/local/apr/lib/
ls 

you should see the compiled file as

libapr-1.la

Download and install Tomcat Native source package

cd /opt/tomcat/bin
sudo wget https://archive.apache.org/dist/tomcat/tomcat-connectors/native/1.2.10/source/tomcat-native-1.2.10-src.tar.gz
sudo tar -xzvf tomcat-native-1.2.10-src.tar.gz
cd tomcat-native-1.2.10-src/native

verify JAVA_HOME

sudo pico ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
source ~/.bashrc
sudo ./configure --with-apr=/usr/local/apr --with-java-home=$JAVA_HOME
sudo make
sudo make install

Edit the /opt/tomcat/bin/setenv.sh file with following line:

sudo pico /opt/tomcat/bin/setenv.sh
export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'

restart tomcat

sudo service tomcat restart


on debian 8 I fix it with installing libapr1-dev:

apt-get install libtcnative-1 libapr1-dev

Had this problem as well. If you do have the libraries, but still have this error, it may be a configuration error. Your server.xml may be missing the following line:

 <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />

(Alternatively, it may be commented out). This <Listener>, like other listeners is a child of the top-level <Server>.

Without the <Listener> line, there's no attempt to load the APR library, so LD_LIBRARY_PATH and -Djava.library.path= settings are ignored.


I had the same problem when tomсat could not find the class. Try to view other log files. Sometimes No class def found error appears in different log files:

  • tomcat8-stdout
  • tomcat8-stderr
  • localhost

If you don't have Tomcat Native library install it with:

sudo apt-get install libtcnative-1

and if it's still there an old version upgrade it with:

sudo apt-get upgrade libtcnative-1


I had this issue upgrading from Java 8 to 11. After adding this dependency, my app launched without issue:

<dependency>
    <groupId>org.javassist</groupId>
    <artifactId>javassist</artifactId>
    <version>3.25.0-GA</version>
</dependency>

On Mac OS X:

$ brew install tomcat-native
==> tomcat-native
In order for tomcat's APR lifecycle listener to find this library, you'll
need to add it to java.library.path. This can be done by adding this line
to $CATALINA_HOME/bin/setenv.sh

  CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/usr/local/opt/tomcat-native/lib"

If $CATALINA_HOME/bin/setenv.sh doesn't exist, create it and make it executable.

Then add it to the eclipse's tomcat arguments (double-click Server > Open Launch Configuration > Arguments tab > VM arguments)

-Djava.library.path=/usr/local/opt/tomcat-native/lib

참고URL : https://stackoverflow.com/questions/8716259/what-does-the-apr-based-apache-tomcat-native-library-was-not-found-mean

반응형