Tomcat 部署 The APR based Apache Tomcat Native ...

Tomcat啓動時提示org.apache.catalina.core.AprLifecycleListener...html

ApacheTomcatJavaJNIIE 網上針對此問題提供的文章不少,但多數和我遇到的狀況有出入,因此我將其記錄於此java

最近開發中須要使用Tomcat,隨意找來個較新的版本6.0.20就用。發現啓動時提示: 「2010-5-12 18:06:06 org.apache.catalina.core.AprLifecycleListener init 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: ...」,打印出的路徑包括了%JAVA_HOME%/bin,%SystemRoot%/system32(WindowsXP),以及系統變量path的值。web

http://tomcat.apache.org/tomcat-6.0-doc/apr.html中,能夠看到對APR的介紹: 「 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).apache

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.

」 並且其安裝須要如下組件的支持: * APR library * JNI wrappers for APR used by Tomcat (libtcnative) * OpenSSL libraries 在網上搜索到的結果中,給出以下的方案: 「到http://tomcat.heanet.ie/native/站點下載符合本地環境的tcnative-1.dll,而後拷貝到%SystemRoot%/system32下,重啓Tomcat便可」, 這麼簡單?好吧。我來到http://tomcat.heanet.ie/native/發現最新的版本爲1.1.14,而README提示穩定版本爲1.1.12。下載完畢,拷貝到system32下,重啓Tomcat,報錯: 「 2010-5-12 17:55:42 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.12. 2010-5-12 17:55:42 org.apache.catalina.core.AprLifecycleListener init 信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 2010-5-12 17:55:43 org.apache.coyote.http11.Http11AprProtocol init 嚴重: Error initializing endpoint org.apache.tomcat.jni.Error: ??????????ó??Э?鯔?????????
at org.apache.tomcat.jni.Socket.create(Native Method) at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:612) at org.apache.coyote.http11.Http11AprProtocol.init(Http11AprProtocol.java:107) at org.apache.catalina.connector.Connector.initialize(Connector.java:1058) at org.apache.catalina.core.StandardService.initialize(StandardService.java:677) at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795) at org.apache.catalina.startup.Catalina.load(Catalina.java:535) at org.apache.catalina.startup.Catalina.load(Catalina.java:555) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:260) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412) 。。。 」 首先聲明的是,這個APR到底能給我帶來什麼樣的實惠,我不清楚;但能夠肯定的是其安裝所需的條件我是知足的,因此那就是拷貝的路徑不正確。但是,換到%JAVA_HOME%/bin下仍然報一樣的錯誤,那應該拷到哪裏呢?個人同事建議我拷到%CATALINA_HOME%/bin下,這倒提醒了我。拷貝,重啓,仍然報錯。。。tomcat

看來應該是tcnative-1.dll版本的問題了。到apache tomcat站點從新下載了兩個最新的版本:5.5.29,6.0.26,解壓一看,問題明白了:tcnative-1.dll的最新版本爲1.1.20,位置在/bin目錄下,我將其拷貝到tomcat6.0.20的/bin下,重啓,正常: 「2010-5-12 18:47:45 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.20. 2010-5-12 18:47:45 org.apache.catalina.core.AprLifecycleListener init 信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 2010-5-12 18:47:45 org.apache.coyote.http11.Http11AprProtocol init 信息: Initializing Coyote HTTP/1.1 on http-9000 2010-5-12 18:47:45 org.apache.coyote.ajp.AjpAprProtocol init 信息: Initializing Coyote AJP/1.3 on ajp-8009 2010-5-12 18:47:45 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 862 ms 2010-5-12 18:47:45 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2010-5-12 18:47:45 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.20 2010-5-12 18:48:06 org.apache.coyote.http11.Http11AprProtocol start 信息: Starting Coyote HTTP/1.1 on http-9000 2010-5-12 18:48:06 org.apache.coyote.ajp.AjpAprProtocol start 信息: Starting Coyote AJP/1.3 on ajp-8009 2010-5-12 18:48:06 org.apache.catalina.startup.Catalina start 信息: Server startup in 20997 ms 2010-5-12 18:48:59 org.apache.coyote.http11.Http11AprProtocol pause 信息: Pausing Coyote HTTP/1.1 on http-9000 2010-5-12 18:48:59 org.apache.coyote.ajp.AjpAprProtocol paus 」 到此,這個問題告一段落,緣由應該就是我隨意拿了一個Tomcat就用致使的,也就是說使用的distribution「 not include the Windows service wrapper nor the compiled APR/native library for Windows」。 至於最新的tcnative-1.dll和Tomcat Native的相關資源能夠訪問http://tomcat.apache.org/native-doc/,http://tomcat.heanet.ie/native/下的嚴重out了。app

相關文章
相關標籤/搜索