Tomcat uses Native Library in Linux
Recently, Tomcat is used. To improve performance, Native Library is used. This is used by default in Windows and has to be re-compiled in Linux.
Default CentOS Installation
Yum install apr
It doesn't seem to work. Must be installed by source code
Wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.0.tar.gz
Tar-zxvf apr-1.5.0.tar.gz
Cd apr-1.5.0
./Configure
Make
Make install
Installed in/usr/local/apr by default
Enter the bin directory of tomcat
Tar-zxvf tomcat-native.tar.gz
Cd tomcat-native-1.1.20-src/
Cd jni/native
./Configure -- with-apr =/usr/local/apr -- with-java-home = "/usr/lib/jvm/java-1.7.0" -- with-ssl = yes
Make
Make install
Installed on
/Usr/local/apr/lib
Cd/usr/lib
Ln-s/usr/local/apr/lib/libapr-1.so.0.5.0 lib-apr-1.so
Ln-s/usr/local/apr/lib/libapr-1.so.0.5.0 lib-apr-1.so.0
Ln-s/usr/local/apr/lib/libtcnative-1.so.0.1.20 libtcnative-1.so
Ln-s/usr/local/apr/lib/libtcnative-1.so.0.1.20 libtcnative-1.so
Or create the setenv. sh file in the bin directory of tomcat installation:
LD_LIBRARY_PATH = $ LD_LIBRARY_PATH: $ CATALINA_HOME/lib
Export LD_LIBRARY_PATH
Check
In conf/server. xml, <Listener className = "org. apache. catalina. core. AprLifecycleListener" SSLEngine = "on"/> is enabled by default.
<Connector port = "8080" protocol = "org. apache. coyote. http11.Http11AprProtocol" maxThreads = "150" connectionTimeout = "20000" redirectPort = "8443">
If the configuration is successful, start tomcat and you will see the following information:
Org. apache. coyote. http11.Http11AprProtocol init
For details about Tomcat Native, click here
Tomcat Native: click here
This article permanently updates the link address: