| 註:取材網路,收集歸納,以備所需。 執行個體一: 安裝完tomcat 5 之後經常會出現這樣的問題,The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: ××××××××××;××××××××總會出現在logs的第一行。 解決這個問題,我們需要安裝native庫,分別在windows和linux下面的安裝方法給一個總結 在linux下比較麻煩,我用的是redhat 1:首先下載安裝apr包。我用的是 apr-1.2.12.tar.gz 下載後依次運行./configure|make|make install三個命令。 2:在tomcat的安裝目錄下bin下面有一個綁定的native library包。解壓之後然後進入有build.xml的目錄中,當然你也可以選擇自己下載的。運行./configure --with-apr="/usr/local/apr/"(apr的預設安裝路徑。當然也可以寫你自己的安裝路徑) 3:在同一個目錄下依次運行make | make install 4:提示build successful之後,需要設定一下環境變數。在選擇提示的任意的一個就可以。我設定的是export LD_LIBRARY_PATH=/usr/local/apr/lib 然後重啟tomcat,問題就解決了。 執行個體二: 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 …… //說明一下window 安裝的方法: 交tcnative.dll檔案放到%JAVA_HOM%/bin/目錄下即可 |