【问题标题】:APR based Apache Tomcat Native library was not found on the java.library.path?在 java.library.path 上找不到基于 APR 的 Apache Tomcat Native 库?
【发布时间】:2011-05-15 18:00:48
【问题描述】:
尝试在 tomcat 上使用 eclipse/linux 运行我的应用程序时
我收到以下信息消息:
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/amd64/server:/usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/amd64:/usr/lib/jvm/java-6-sun-1.6.0.20/jre/../lib/amd64:/usr/lib64/xulrunner-addons:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
我该如何解决这个问题?
【问题讨论】:
标签:
apache
tomcat
jakarta-ee
【解决方案1】:
我的情况:
看到相同的 INFO 消息。
Centos 6.2 x86_64
雄猫 6.0.24
这解决了我的问题:
yum install tomcat-native
轰隆隆!
【解决方案2】:
我通过删除我的旧服务器并再次创建它来解决这个问题(在 Eclipse IDE 上)。此错误是因为您没有正确终止 Tomcat 服务器并关闭 Eclipse。
【解决方案3】:
Download 为您的操作系统提供适当的基于 APR 的 tomcat 本机库,以便 Apache tomcat 服务器可以利用您的操作系统的一些功能,该功能默认情况下不包含在 tomcat 中。对于 Windows,它将是一个 .dll 文件。
我在启动服务器时也收到了警告,如果您正在测试或开发,则不必担心这一点。这是出于生产目的。
将 tcnative-1.dll 文件放入 Apache Tomcat 7 的 bin 文件夹后,以下是 stderr 文件中的输出,
Apr 07, 2015 1:14:12 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.33 using APR version 1.5.1.
Apr 07, 2015 1:14:12 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Apr 07, 2015 1:14:14 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1m 19 Mar 2015)
Apr 07, 2015 1:14:14 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-127.0.0.1"]
【解决方案4】:
对于 Ubntu 用户
1. Install compilers
#sudo apt-get install make
#sudo apt-get install gcc
2. Install openssl and development libraries
#sudo apt-get install openssl
#sudo apt-get install libssl-dev
3. Install the APR package (Downloaded from http://apr.apache.org/)
#tar -xzf apr-1.4.6.tar.gz
#cd apr-1.4.6/
#sudo ./configure
#sudo make
#sudo make install
You should see the compiled file as
/usr/local/apr/lib/libapr-1.a
4. Download, compile and install Tomcat Native sourse package
tomcat-native-1.1.27-src.tar.gz
Extract the archive into some folder
#tar -xzf tomcat-native-1.1.27-src.tar.gz
#cd tomcat-native-1.1.27-src/jni/native
#JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21/
#sudo ./configure --with-apr=/usr/local/apr --with-java-home=$JAVA_HOME
#sudo make
#sudo make install
Now I have compiled Tomcat Native library in /usr/local/apr/libtcnative-1.so.0.1.27 and symbolic link file /usr/local/apr/@libtcnative-1.so pointed to the library
5. Create or edit the $CATALINA_HOME/bin/setenv.sh file with following lines :
export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'
6. Restart tomcat and see the desired result: