JAVA—咖啡馆

——欢迎访问rogerfan的博客,常来《JAVA——咖啡馆》坐坐,喝杯浓香的咖啡,彼此探讨一下JAVA技术,交流工作经验,分享JAVA带来的快乐!本网站部分转载文章,如果有版权问题请与我联系。

BlogJava 首页 新随笔 联系 聚合 管理
  447 Posts :: 145 Stories :: 368 Comments :: 0 Trackbacks

tomcat的运行模式有3.修改他们的运行模式.3种模式的运行是否成功,可以看他的启动控制台,或者启动日志.或者登录他们的默认页面http://localhost:8080/查看其中的服务器状态。 

1)bio 

默认的模式,性能非常低下,没有经过任何优化处理和支持

2)nio 

利用java的异步io护理技术,noblocking IO技术

想运行在该模式下,直接修改server.xml里的Connector节点,修改protocol 

 <Connector port="80" protocol="org.apache.coyote.http11.Http11NioProtocol"          connectionTimeout="20000"          URIEncoding="UTF-8"          useBodyEncodingForURI="true"          enableLookups="false"          redirectPort="8443" /> 

启动后,就可以生效。 

3)apr 

安装起来最困难,但是从操作系统级别来解决异步的IO问题,大幅度的提高性能

必须要安装aprnative,直接启动就支持apr。下面的修改纯属多余,仅供大家扩充知识,但仍然需要安装aprnative 

nio修改模式,修改protocolorg.apache.coyote.http11.Http11AprProtocol

 安装APR

APR项目有APRAPR-utilAPR-iconv,其中APR-iconv是可选安装的。

下载最新的APRAPR-util源码包

2.1安装APR

1)解压apr-1.4.6:tar -zxf apr-1.4.6

2) cd apr-1.4.6

3)依次执行./configure

make   

sudo make install

apr被安装到了/usr/local/apr目录下面

 

2.2 安装APR-util

1) 解压apr-util-1.4.1tar -zxfapr-util-1.4.1

2) cd apr-util-1.4.1

3) 依次执行./configure--with-apr=/usr/local/apr/bin/apr-1-config  (如果不加后面的可能会报APR找不到的错误"checkingfor APR... no 
    configure: error: APR could not be located. Please use the--with-apr option."

make

sudo make install

apr-util也被安装找/usr/local/apr下面

 

2.3进入tomcat主目录下,在bin/tomcat-native-1.1.23-src/jni/native下面依次执行:

./configure--with-apr=/usr/local/apr/bin/apr-1-config  (如果不加后面的可能会报APR找不到的错误"checkingfor APR... no 
    configure: error: APR could not be located. Please use the--with-apr option."

make

sudo make install

 

2.4. 设置启动参数:

catalina.sh 加入启动参数:

CATALINA_OPTS="$CATALINA_OPTS-Djava.library.path=/usr/local/apr/lib"

 

根据以上步骤安装

报错:2013-1-1516:43:48 org.apache.catalina.core.AprLifecycleListener init

An incompatibleversion 1.1.0 of the APR based Apache Tomcat Nativelibrary is installed, while Tomcat requires version 1.1.24

出现这个错误一般应该是/etc/profile里面设置没生效,加在catalina.sh中即可,只要你装的版本不低,就不要试图重装其他啥的,那些只会浪费时间精力

posted on 2013-08-01 08:51 rogerfan 阅读(1952) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: