转载请注明:
作者:
Sutra
Tomcat 可以使用 apr 来提供更好的伸缩性、性能和集成到本地服务器技术。
在进行下面的操作之前,请先通过 ports 安装好 apr(/usr/ports/devel/apr)、Tomcat6(/usr/ports/www/tomcat6)。
并在 /etc/rc.conf 中添加 tomcat60_enable="YES"。
启动 tomcat
# /usr/local/etc/rc.d/tomcat6 start
默认情况下按照好了 Tomcat 6,启动时会在 /usr/local/apache-tomcat6.0/logs/stdout.log 里出现下面的日志:
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/local/diablo-jdk1.5.0/jre/lib/i386/client:/usr/local/diablo-jdk1.5.0/jre/lib/i386:/usr/local/diablo-jdk1.5.0/jre/../lib/i386:/usr/lib:/usr/local/lib
下面就来安装 tomcat-native,
# cd /usr/local/apache-tomcat6.0/bin
# tar xvf tomcat-native.tar.gz
# cd ./tomcat-native-1.1.10-src/jni/native/
# setenv JAVA_HOME /usr/local/diablo-jdk1.5.0/
# ./configure –with-apr=/usr/local
# make
# make install
安装好了之后会有个提示:
———————————————————————-
Libraries have been installed in:
/usr/local/apr/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR’
flag during linking and do at least one of the following:
– add LIBDIR to the `LD_LIBRARY_PATH’ environment variable
during execution
– add LIBDIR to the `LD_RUN_PATH’ environment variable
during linking
– use the `-Wl,–rpath -Wl,LIBDIR’ linker flag
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
———————————————————————-
安装后多出一个目录 /usr/local/apr
然后安装上面的提示操作一下就好了,我这里用的 link 的方式:
# ln -s /usr/local/apr/lib/libtcnative-1.so /usr/local/diablo-jdk1.5.0/jre/lib/i386/libtcnative-1.so
再重启 tomcat,
# /usr/local/etc/rc.d/tomcat6 restart
再看 tomcat 的日志:
# cat /usr/local/apache-tomcat6.0/logs/stdout.log
Aug 6, 2007 11:40:01 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded Apache Tomcat Native library 1.1.10.
Aug 6, 2007 11:40:01 PM org.apache.catalina.core.AprLifecycleListener init
……
嗯,看起来安装成功了。
更多信息和其它的配置还是去看 http://tomcat.apache.org/tomcat-6.0-doc/apr.html 吧。