今天使用eclipse搭建tomcat服務後,啟動服務,提示一串異常
資訊: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Program Files\Java\jre1.6.0_05\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:/Program Files/Java/jdk1.6.0_05/bin/../jre/bin/client;D:/Program Files/Java/jdk1.6.0_05/bin/../jre/bin;D:/Program Files/Java/jdk1.6.0_05/bin/../jre/lib/i386;D:\Program Files\Java\jdk1.6.0_05\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\MySQL\MySQL Server 5.0\bin;D:\Program Files\Rational\common;E:\安裝檔案\eclipse;
解決方案:到http://tomcat.heanet.ie/native/1.1.10/binaries/win32/tcnative-1.dll下載tcnative-1.dll,分別放到tomcat和jdk的bin目錄下。
為什麼呢?下面說是在tomcat啟動Djava.library.path對應的註冊表路徑去找tcnative-1.dll這個檔案。
我感覺這個和我們使用tomcat和自己下載JDK組合在一起有關。
http://tomcat.10.x6.nabble.com/tcnative-1-dll-td2128930.html
How can I tell for sure that tcnative-1.dll is used by tomcat ?
System is Windows 2003 SP2, Tomcat 5.5.20, JDK 1.5.0_11, tcnative-1.dll used is 1.1.12
Tomcat is started as a service.
File tcnative-1.dll is placed in directory mentioned within
-Djava.library.path =... in registry.
If it's not in this directory there is a warning in stdout.log(which is the only one used for logging).
(....can't find... tcnative-1.dll... ), but when it's placed in the directory, there is no message about it's loading (as stated in
http://tomcat.apache.org/native-doc/).
Difference in version behaviour, or...?
再次tomcat啟動服務,沒有異常。
2013-8-12 22:46:57 org.apache.catalina.core.AprLifecycleListener init資訊: Loaded APR based Apache Tomcat Native library 1.1.10.2013-8-12 22:46:57 org.apache.catalina.core.AprLifecycleListener init資訊: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], random [true].2013-8-12 22:46:58 org.apache.coyote.http11.Http11AprProtocol init資訊: Initializing Coyote HTTP/1.1 on http-80802013-8-12 22:46:58 org.apache.coyote.ajp.AjpAprProtocol init資訊: Initializing Coyote AJP/1.3 on ajp-80092013-8-12 22:46:58 org.apache.catalina.startup.Catalina load資訊: Initialization processed in 1050 ms2013-8-12 22:46:58 org.apache.catalina.core.StandardService start資訊: Starting service Catalina2013-8-12 22:46:58 org.apache.catalina.core.StandardEngine start資訊: Starting Servlet Engine: Apache Tomcat/6.0.202013-8-12 22:46:58 org.apache.coyote.http11.Http11AprProtocol start資訊: Starting Coyote HTTP/1.1 on http-80802013-8-12 22:46:58 org.apache.coyote.ajp.AjpAprProtocol start資訊: Starting Coyote AJP/1.3 on ajp-80092013-8-12 22:46:58 org.apache.catalina.startup.Catalina start資訊: Server startup in 347 ms
問題出現了,我們訪問http://localhost:8080/沒顯示tom老貓
這東西坑了我2個多小時,終於找到原因了。
解決方案:
1、雙擊tomcat服務,會顯示圖片中的內容。
2、修改中的兩項,改為第二項單選框,下面的路徑名修改成webapps。別忘了ctrl+s 儲存下,然後再去重啟 tomcat服務,就ok啦。
3、tom老貓啟動成功啦,看下他的時間20多秒啊,一般啟動幾毫秒都是有點問題的。在訪問http://localhost:8080/就能進到首頁了。
參考網站:http://blog.knowsky.com/257398.htm