`

关于Apache Portable Runtime and Tomcat

阅读更多

关于Apache Portable Runtime and Tomcat

在从Tomcat 5.0.28转向5.5.X时,在启动时发现出现如下信息
[org.apache.catalina.core.AprLifecycleListener]-[INFO] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: (...你的系统环境PATH路径...)

在停止时发现出现如下信息
[org.apache.catalina.core.AprLifecycleListener]-[INFO] Failed shutdown of Apache Portable Runtime

于是,想消除这个问题,通过查阅 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目录下:)

这样设置后,启动可以看到信息如下:
[org.apache.coyote.http11.Http11AprProtocol]-[INFO] Initializing Coyote HTTP/1.1 on http-9091
在停止时发现出现如下信息
[org.apache.coyote.http11.Http11AprProtocol]-[INFO] Pausing Coyote HTTP/1.1 on http-9091
......
[org.apache.coyote.http11.Http11AprProtocol]-[INFO] Stopping Coyote HTTP/1.1 on http-9091

这样就配置成功了。性能方面目前没有做详细的测试。
======================================================================
相关的文档参见
http://tomcat.apache.org/tomcat-5.5-doc/apr.html

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

分享到:
评论
5 楼 coffeesweet 2010-04-20  
谁试过用tomcat5.5.28配置apr,windows环境下的,报java.lang.NoSuchFieldException: TCN_MAJOR_VERSION
错误
至今没解决
4 楼 leesazhang 2009-02-18  
成功!
谢谢!
3 楼 xmx0632 2008-11-27  
Ethip 写道

我的Tomcat6.0.14也出现了和你类似的问题,我严格按照你说的两个的方法去做了,还是没有弄好!不知我哪里搞错了,是否还有其他的原因?


一、我从%tomcat%\bin中启动startup。bat时,弹出窗口:
应用程序或DLL:F:\tomcat\bin\tcnative-1.dll为无效的Windows映像。请再检测一遍你的安装盘。连续点了5次”确定“后,出现的提示是和你的类似

2008-4-16 12:44:25 org.apache.catalina.core.AprLifecycleListener init
信息: The Apache Tomcat Native library which allows optimal performance in produ
ction environments was not found on the java.library.path: (我的系统环境变量)。。。。

但是服务器还算是能启动了!
我新建了一个简单的jsp测试页面,以管理员的身份进点进去还是能正常显示的!但这样终究不是办法,觉得不舒服,因为在MyEclipse中启动Tomcat就很严重了!!!

二、从MyEclipse5.5.1GA中启动Tomcat
点了start后,打开了一个Integer.class页面,里面说“Source not found”

我一路点了Resume,Console下出现如下提示:

2008-4-16 12:52:33 org.apache.catalina.core.AprLifecycleListener init
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: E:\Appsoftware\jdk1.5.0\bin;F:\tomcat\bin
2008-4-16 12:52:35 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-80
2008-4-16 12:52:35 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 11316 ms
2008-4-16 12:52:35 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2008-4-16 12:52:35 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.14
2008-4-16 12:52:37 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2008-4-16 12:52:37 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2008-4-16 12:52:40 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-80
2008-4-16 12:52:40 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2008-4-16 12:52:40 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/47  config=null
2008-4-16 12:52:40 org.apache.catalina.startup.Catalina start
信息: Server startup in 4719 ms



提示的意思和前面的差不多,也弹出了那个提示窗口!

不知道这遇到的是什么情形的错误?


应该是你的dll文件不完整导致报错,比如只下载了一半,但文件看起来还是正常的时候就会报这种错
2 楼 Ethip 2008-04-16  
我的Tomcat6.0.14也出现了和你类似的问题,我严格按照你说的两个的方法去做了,还是没有弄好!不知我哪里搞错了,是否还有其他的原因?


一、我从%tomcat%\bin中启动startup。bat时,弹出窗口:
应用程序或DLL:F:\tomcat\bin\tcnative-1.dll为无效的Windows映像。请再检测一遍你的安装盘。连续点了5次”确定“后,出现的提示是和你的类似

2008-4-16 12:44:25 org.apache.catalina.core.AprLifecycleListener init
信息: The Apache Tomcat Native library which allows optimal performance in produ
ction environments was not found on the java.library.path: (我的系统环境变量)。。。。

但是服务器还算是能启动了!
我新建了一个简单的jsp测试页面,以管理员的身份进点进去还是能正常显示的!但这样终究不是办法,觉得不舒服,因为在MyEclipse中启动Tomcat就很严重了!!!

二、从MyEclipse5.5.1GA中启动Tomcat
点了start后,打开了一个Integer.class页面,里面说“Source not found”

我一路点了Resume,Console下出现如下提示:

2008-4-16 12:52:33 org.apache.catalina.core.AprLifecycleListener init
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: E:\Appsoftware\jdk1.5.0\bin;F:\tomcat\bin
2008-4-16 12:52:35 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-80
2008-4-16 12:52:35 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 11316 ms
2008-4-16 12:52:35 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2008-4-16 12:52:35 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.14
2008-4-16 12:52:37 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2008-4-16 12:52:37 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2008-4-16 12:52:40 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-80
2008-4-16 12:52:40 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2008-4-16 12:52:40 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/47  config=null
2008-4-16 12:52:40 org.apache.catalina.startup.Catalina start
信息: Server startup in 4719 ms



提示的意思和前面的差不多,也弹出了那个提示窗口!

不知道这遇到的是什么情形的错误?
1 楼 lyo 2007-05-22  
这样作真的会和apache处理 静态html的性能差不多么

相关推荐

Global site tag (gtag.js) - Google Analytics