首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

tomcat6 native装配

2012-09-20 
tomcat6 native安装Apache Tomcat Native library 是 Apache 为了提升 Tomcat 的性能搞的一套本地化 Socke

tomcat6 native安装
    Apache Tomcat Native library 是 Apache 为了提升 Tomcat 的性能搞的一套本地化 Socket, Thread, IO 组件也就是说它有高级 IO 功能, 操作系统级别的功能调用, 以及本地进程处理等等, 这些都能使 Tomcat 更像一个 Web Server(像Apache那样), 而不是只能用来解释JSP, 大大增加了Tomcat作为服务器的吞吐性能,尤其是处理静态文件能力。

     在安装nactive lib之前必须安装以下linux lib


1.APR library
2.OpenSSL libraries
3.Java SE Development Kit (JDK)

     

    在支持rpm的linux中,可以通过yum超级方便的进行更新:
   

 yum install apr-devel openssl-devel

   
    下载最新的最新的tomcat包:apache-tomcat-6.0.29.tar.gz

[root@localhost ~] mv apache-tomcat-6.0.29.tar.gz /opt/[root@localhost ~] cd /opt[root@localhost opt]tar zxvf apache-tomcat-6.0.29.tar.gz


    其实在tomcat的bin目录下已经附带了native的源代码,这里直接进入解压缩就可以

cd apache-tomcat-6.0.29/bintar zxvf tomcat-native.tar.gz


    这里要进行编译安装,需要gcc编译器,如果没有可以继续通过yum安装

[root@localhost bin]# yum search gcc*已加载插件:fastestmirror, presto, refresh-packagekitLoading mirror speeds from cached hostfile * fedora: ftp.cuhk.edu.hk * updates: ftp.cuhk.edu.hk警告:没有匹配 gcc* 的软件包没有找到匹配的软件包[root@localhost bin]# yum search gcc已加载插件:fastestmirror, presto, refresh-packagekitLoading mirror speeds from cached hostfile * fedora: ftp.cuhk.edu.hk * updates: ftp.cuhk.edu.hk=========================================================== Matched: gcc ===========================================================arm-gp2x-linux-gcc.i686 : Cross Compiling GNU GCC targeted at arm-gp2x-linuxavr-gcc.i686 : Cross Compiling GNU GCC targeted at avrcompat-libgcc-296.i686 : Compatibility 2.96-RH libgcc librarygcc-gnat.i686 : Ada 95 support for GCCgcc-objc.i686 : Objective-C support for GCCgcc-objc++.i686 : Objective-C++ support for GCCgccxml.i686 : XML output extension to GCClibgcc.i686 : GCC version 4.4 shared support librarymingw32-gcc.i686 : MinGW Windows cross-compiler (GCC) for Cmsp430-gcc.i686 : Cross Compiling GNU GCC targeted at msp430avr-gcc-c++.i686 : Cross Compiling GNU GCC targeted at avrcompat-gcc-34.i686 : Compatibility GNU Compiler Collectioncompat-gcc-34-c++.i686 : C++ support for compatibility compilercompat-gcc-34-g77.i686 : Fortran 77 support for compatibility compilergcc.i686 : Various compilers (C, C++, Objective-C, Java, ...)gcc-c++.i686 : C++ support for GCCgcc-gfortran.i686 : Fortran support.....这里省略了,搜出来好多这里只用C编译器就可以了,其他的都可以不要[root@localhost bin] yum install gcc.i686


     安装完成后,下边开始./configure

[root@localhost bin]# cd tomcat-native-1.1.20-src/[root@localhost tomcat-native-1.1.20-src]# cd jni/native[root@localhost native]# ./configure --with-apr=/usr/bin/apr-1-config \                                     --with-java-home=/usr/share/java-1.6.0/jdk1.6.0_21 \                                     --with-ssl=yes \                                     --prefix=/opt/tomcat


--with-apr=/usr/bin/apr-1-config \  #这里是刚才安装apr lib的开发工具
--with-java-home=/usr/share/java \  #这里配置JAVA_HOME
--with-ssl=yes \                    #这里设置是否启用ssl安全连接
--prefix=$CATALINA_HOME             #这里是设置tomcat所在目录

    ./configure完成后开始make与make install

[root@localhost native]# make && make install


    此时编译出的lib放在tomcat/lib下,需要cp到/usr/lib下

[root@localhost native]# cd /opt/tomcat/lib[root@localhost native]# ls annotations-api.jar  el-api.jar      libtcnative-1.a          pkgconfig           tomcat-i18n-fr.jarcatalina-ant.jar     jasper-el.jar   libtcnative-1.la         servlet-api.jar     tomcat-i18n-ja.jarcatalina-ha.jar      jasper.jar      libtcnative-1.so         tomcat-coyote.jar   tomcat-native-1.1.17-dev.jarcatalina.jar         jasper-jdt.jar  libtcnative-1.so.0       tomcat-dbcp.jarcatalina-tribes.jar  jsp-api.jar     libtcnative-1.so.0.1.20  tomcat-i18n-es.jar[root@localhost native]# cp libtcnative-1* /usr/lib/


    ok.已经完成tomcat-native的编译、安装与部署,测试一下

[root@localhost native]# cd /opt/tomcat/bin[root@localhost bin]# ./catalina.sh runUsing CATALINA_BASE:   /opt/tomcatUsing CATALINA_HOME:   /opt/tomcatUsing CATALINA_TMPDIR: /opt/tomcat/tempUsing JRE_HOME:        /usr/share/java-1.6.0/jdk1.6.0_21Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar2010-8-22 1:44:50 org.apache.catalina.core.AprLifecycleListener init信息: Loaded APR based Apache Tomcat Native library 1.1.20.2010-8-22 1:44:50 org.apache.catalina.core.AprLifecycleListener init信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].2010-8-22 1:44:50 org.apache.coyote.http11.Http11AprProtocol init信息: Initializing Coyote HTTP/1.1 on http-80802010-8-22 1:44:50 org.apache.coyote.ajp.AjpAprProtocol init信息: Initializing Coyote AJP/1.3 on ajp-80092010-8-22 1:44:50 org.apache.catalina.startup.Catalina load信息: Initialization processed in 628 ms2010-8-22 1:44:50 org.apache.catalina.core.StandardService start信息: Starting service Catalina2010-8-22 1:44:50 org.apache.catalina.core.StandardEngine start信息: Starting Servlet Engine: Apache Tomcat/6.0.292010-8-22 1:44:50 org.apache.catalina.startup.HostConfig deployDescriptor信息: Deploying configuration descriptor manager.xml2010-8-22 1:44:50 org.apache.catalina.startup.HostConfig deployDescriptor信息: Deploying configuration descriptor host-manager.xml2010-8-22 1:44:50 org.apache.catalina.startup.HostConfig deployDirectory信息: Deploying web application directory docs2010-8-22 1:44:50 org.apache.catalina.startup.HostConfig deployDirectory信息: Deploying web application directory ROOT2010-8-22 1:44:50 org.apache.catalina.startup.HostConfig deployDirectory信息: Deploying web application directory examples2010-8-22 1:44:51 org.apache.coyote.http11.Http11AprProtocol start信息: Starting Coyote HTTP/1.1 on http-80802010-8-22 1:44:51 org.apache.coyote.ajp.AjpAprProtocol start信息: Starting Coyote AJP/1.3 on ajp-80092010-8-22 1:44:51 org.apache.catalina.startup.Catalina start信息: Server startup in 605 ms



2010-8-22 1:44:50 org.apache.catalina.core.AprLifecycleListener init
信息: Loaded APR based Apache Tomcat Native library 1.1.20.
2010-8-22 1:44:50 org.apache.catalina.core.AprLifecycleListener init
信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].

    看到上边这两行,表示已经成功启动Apache Tomcat Native library. :)


     
   

热点排行