错误日志:
The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path:
找到对应平台安装办法:
Linux
Most Linux distributions will ship packages for APR and OpenSSL. The JNI wrapper (libtcnative) will then have to be compiled. It depends on APR, OpenSSL, and the Java headers.
Requirements:
- APR 1.2+ development headers (libapr1-dev package)
- OpenSSL 0.9.7+ development headers (libssl-dev package)
- JNI headers from Java compatible JDK 1.4+
- GNU development environment (gcc, make)
The wrapper library sources are located in the Tomcat binary bundle, in the bin/tomcat-native.tar.gz
archive. Once the build environment is installed and the source archive is extracted, the wrapper library can be compiled using (from the folder containing the configure script):
![]() | ![]() | ![]() |
![]() | ./configure && make && make install | ![]() |
首先按要求 安装 APR OpenSSL 等等
然后 进入
~/web/apache-tomcat-7.0.14/bin$
解压 tomcat-native.tar.gz
再进入 ~/web/apache-tomcat-7.0.14/bin/tomcat-native-1.1.20-src/jni/native$
执行 官网提示的
./configure && make && make install
但一般不会成功,提示需要 添加参数
--with-apr
按提示:
--with-apr=/usr/bin/apr-1-config --with-java-home=/usr/lib/jvm/java-6-sun-1.6.0.26 --with-ssl=yes --prefix=/home/dengpei/web/apache-tomcat-7.0.14
以上配置可以 查看 ~/.bashrc 文件
最终会在lib 目录生成 libtcnative 相关文件
dengpei@dengpei-pc:~/web/apache-tomcat-7.0.14/lib$ ls
annotations-api.jar jsp-api.jar tomcat-api.jar
catalina-ant.jar libtcnative-1.a tomcat-coyote.jar
catalina-ha.jar libtcnative-1.la tomcat-dbcp.jar
catalina.jar libtcnative-1.so tomcat-i18n-es.jar
catalina-tribes.jar libtcnative-1.so.0 tomcat-i18n-fr.jar
ecj-3.6.2.jar libtcnative-1.so.0.1.20 tomcat-i18n-ja.jar
el-api.jar mysql-connector-java-5.1.18-bin.jar tomcat-util.jar
jasper-el.jar pkgconfig
jasper.jar servlet-api.jar
dengpei@dengpei-pc:~/web/apache-tomcat-7.0.14/lib$
ls -l :
-rw-r--r-- 1 dengpei dengpei 1563680 2011-11-30 15:48 libtcnative-1.a
-rwxr-xr-x 1 dengpei dengpei 1071 2011-11-30 15:48 libtcnative-1.la
lrwxrwxrwx 1 dengpei dengpei 23 2011-11-30 15:48 libtcnative-1.so -> libtcnative-1.so.0.1.20
lrwxrwxrwx 1 dengpei dengpei 23 2011-11-30 15:48 libtcnative-1.so.0 -> libtcnative-1.so.0.1.20
-rwxr-xr-x 1 dengpei dengpei 880487 2011-11-30 15:48 libtcnative-1.so.0.1.20
最后将这些文件 拷贝到 /usr/lib/
cp libtcnative-1* /usr/lib/
运行 正常。