解决Tomcat启动时出现异常冗杂信息--Apache Portable Runtime and Tomcat

很多时候我们刚刚下载的tomcat在启动的时候会看到类似下面的冗杂信息: 

2007 - 12 - 15   21 : 39 : 21  org.apache.catalina.core.AprLifecycleListener lifecycleEvent

信息: The Apache Tomcat Native library which allows optimal performance 
in  produ
ction environments was not found on the java.library.path: D:jdk1.
5 .0_06/bin;.;
C:WINDOWSsystem32;C:WINDOWS;D:jdk1.
5 .0_06/bin;D:oracleora92/bin;C:Program
 FilesOraclejre
1.3 . 1/b in;C:Program FilesOraclejre 1.1 . 8/b in;C:WINDOWSsys
tem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:Program FilesMicrosoft SQL Server
80 ToolsBINN

发生这种情况是因为Tomcat建议使用apache的apr
解决办法:
到 http://tomcat.heanet.ie/native/ 下载编译好的 tcnative-1.dll 文件,目前最新为1.1.10,拷贝至jdk/bin下或Tomcat的bin目录下,重新启动Tomcat就可以成功加载APR了.
信息如下:

2007 - 12 - 15   22 : 48 : 30  org.apache.coyote.http11.Http11AprProtocol init
信息: Initializing Coyote HTTP
/ 1.1  on http - 8080
2007 - 12 - 15   22 : 48 : 30  org.apache.coyote.ajp.AjpAprProtocol init
信息: Initializing Coyote AJP
/ 1.3  on ajp - 8009
2007 - 12 - 15   22 : 48 : 30  org.apache.catalina.startup.Catalina load
信息: Initialization processed 
in   1063  ms
2007 - 12 - 15   22 : 48 : 30  org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2007 - 12 - 15   22 : 48 : 30  org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat
/ 5.5 . 20
2007 - 12 - 15   22 : 48 : 30  org.apache.catalina.core.StandardHost start
.......................

官方信息可查阅:
地址: http://tomcat.apache.org/tomcat-5.5-doc/apr.html

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).

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.

似乎是Tomcat 可以用 Apache Portable Runtime 来提供更强性能,提升Web静态页面的处理能力,
不再需要专门的Web Server来处理静态页面了。
但是APR的支持需要安装三个本地组件
APR support requires three main native components to be installed:
1、APR library
2、JNI wrappers for APR used by Tomcat (libtcnative)
3、OpenSSL libraries
解决:Windows下的安装配置与使用
1、先去 http://tomcat.heanet.ie/native/ 下载编译好的 tcnative-1.dll 文件,也可以下载tomcat-native.zip自己进行编译
2、修改一下 catalina.bat,加上
  set CATALINA_OPTS="-Djava.library.path=../../APR/lib"
因为我把这个DLL放在与Tomcat目录同级的APR/lib目录下,所以采用了相对路径。或者把dll加到你的系统变量PATH里之类的,最简单的方法应当就是把tcnative-1.dll文件放在Tomcat的bin目录下

相关的性能测试结果可以参见:
http://www.javaworld.com.tw/jute/post/view?bid=9&id=139958&sty=3&age=0

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值