Tomcat 7 APR 安装和配置
1. 什么是APR,APR (Apache Portable Runtime) is an open source project, which is supported by the?
Apache Foundation software. The main goal of this project is to provide the?
developer with an API, through which they can code and predict the identical?
behavior, regardless of different platforms. It eliminates the requirement of?
additional code dependency for different operating systems. For more information?
on this project, please visit http://apr.apache.org/. (extract from apache tomcat 7 essentials)
?
Tomcat can use the?Apache Portable Runtime?to provide superior scalability, performance, and better integration with native server technologies. The Apache Portable Runtime is a highly portable library that is at the heart of Apache HTTP Server 2.x. APR has many uses, including access to advanced IO functionality (such as sendfile, epoll and OpenSSL), OS level functionality (random number generation, system status, etc), and native process handling (shared memory, NT pipes and Unix sockets).
?
These features allows making Tomcat a general purpose webserver, will enable much better integration with other native web technologies, and overall make Java much more viable as a full fledged webserver platform rather than simply a backend focused technology.
?
2. 安装APR
APR项目有APR, APR-util和APR-iconv,其中APR-iconv是可选安装的。
下载最新的APR和APR-util源码包
2.1安装APR
1)解压apr-1.4.6: tar -zxf apr-1.4.6
2) cd apr-1.4.6
3)依次执行./configure
make???
sudo make install
在apr被安装到了/usr/local/apr目录下面
?
2.2 安装APR-util
1) 解压apr-util-1.4.1: tar -zxf apr-util-1.4.1
2) cd apr-util-1.4.1
3) 依次执行 ./configure --with-apr=/usr/local/apr/bin/apr-1-config? (如果不加后面的可能会报APR找不到的错误"checking for APR... no?
??? configure: error: APR could not be located. Please use the --with-apr option."
make
sudo make install
apr-util也被安装找/usr/local/apr下面
?
3. 进入tomcat主目录下,在bin/tomcat-native-1.1.23-src/jni/native下面依次执行:
./configure --with-apr=/usr/local/apr/bin/apr-1-config? (如果不加后面的可能会报APR找不到的错误"checking for APR... no?
??? configure: error: APR could not be located. Please use the --with-apr option."
make
sudo make install
?
4. 设置启动参数:
在catalina.sh 加入启动参数: CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/usr/local/apr/lib"
http://jiayanjujyj.iteye.com/blog/1560506