The APR based Apache Tomcat Native Library which allows optimal performance in production environments is not found on th E Java.library.path:...tomcat can integrate local APR, faster when dealing with static resources, in a word, use local APR library to improve processing efficiency. On the internet, a lot of people mentioned this problem, to solve the problem is very simple, but Windows and Linux processing method is not the same. Here's how to solve the problem separately.
Window Platform
when you start under window, you will be prompted by is not found on the java.library.path:c:toolsjdk1.6.0_29bin; C:windowssunjavabin; C:windowssystem32; C:windows ..., this according to each person's environment different, may give the path is also not very same, as long as the Native library copies to one of the above paths, Native Library is what, the Internet has to provide downloads, in fact, not so troublesome, In Tomcat's Bin directory, the filename is: Tcnative-1.dll. For example, if I copy this file to C:toolsjdk1.6.0_29bin, and then start Tomcat, there's no such hint.
Linux Platform
Linux is more complex, because the Tomcat package does not provide the compiled so file, so you need to compile, the Tomcat release provides the source code, files for Tomcat bin/ Tomcat-native.tar.gz, in addition to the need to rely on the APR 1.2, OpenSSL, if the machine is not installed, you can use the Yum-y install Apr-devel openssl-devel to install. After decompression tomcat-native.tar.gz will get a tomcat-native-1.1.20-src directory, native library source files are located in tomcat-native-1.1.20-src/jni/ Native, enter the directory, execute./configure, you may see Configure:error:APR could not being located. Please use THE–WITH-APR option. Error prompts, this time with –WITH-APR to develop the position of APR, I use the
./configure--with-apr=/usr/bin/apr-1-config, go through, and then execute make && makes install compilation even if it is done, you should be able to/usr/local/apr/lib /See a file named libtcnative-1.so, copy the file to any one of the paths prompted at Tomcat startup.
The other side of the law
It is described above if you solve this problem under Windows and Linux. Recent use of Mac OS, also encountered the same problem, the solution is similar to Linux, the only difference is the need to specify Java home when configure
I compile the first condition introduction already has GCC installed, about if the installation of GCC, you can refer to: Mac OS Lion installation GCC memo, dependent libraries appear to be the default system, if the compiler prompts the lack of library, you can use port to install, by the way port CentOS is a similar package management software under Yum and Ubuntu under the Apt-get. The Configure parameter I use is set as follows:
./configure--with-apr=/usr/bin/apr-1-config--with-java-home=/system/library/frameworks/javavm.framework/-- With-os-type=headers/then compiles and completes using make, make install. If successful, a library file named Libtcnative-1.0.dylib is generated under the directory/usr/local/apr/lib/, using the ln command to make a soft link to a directory mentioned in the above warning message, for example:
Ln-s/usr/local/apr/lib/libtcnative-1.dylib/library/java/extensions/