今天使用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-8080
2013-8-12 22:46:58 org.apache.coyote.ajp.AjpAprProtocol init
信息: Initializing Coyote AJP/1.3 on ajp-8009
2013-8-12 22:46:58 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1050 ms
2013-8-12 22:46:58 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2013-8-12 22:46:58 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.20
2013-8-12 22:46:58 org.apache.coyote.http11.Http11AprProtocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2013-8-12 22:46:58 org.apache.coyote.ajp.AjpAprProtocol start
信息: Starting Coyote AJP/1.3 on ajp-8009
2013-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/就能进到主页了。