小编给大家分享一下Linux下Tomcat8.0.44如何配置使用Apr,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
配置具体如下
1.安装apr 1.5.2
[root@ecs-3c46 ]# cd /usr/local/src [root@ecs-3c46 src]# wget http://apache.fayea.com//apr/apr-1.5.2.tar.gz [root@ecs-3c46 src]# tar -xzvf apr-1.5.2.tar.gz [root@ecs-3c46 src]# cd apr-1.5.2 [root@ecs-3c46 apr-1.5.2]# ./configure --prefix=/usr/local/apr [root@ecs-3c46 apr-1.5.2]# make [root@ecs-3c46 apr-1.5.2]# make install
2.安装apr-util-1.5.4
[root@ecs-3c46 ]# cd /usr/local/src [root@ecs-3c46 src]# wget http://mirrors.hust.edu.cn/apache//apr/apr-util-1.5.4.tar.gz [root@ecs-3c46 src]# tar -xzvf apr-util-1.5.4.tar.gz [root@ecs-3c46 src]# cd apr-util-1.5.4 [root@ecs-3c46 apr-util-1.5.4]# ./configure --prefix=/usr/local/apr [root@ecs-3c46 apr-util-1.5.4]# make [root@ecs-3c46 apr-util-1.5.4]# make install
3.如果没有安装openssl的请安装下openssl,已经安装的继续下一步
4.安装 tomcat-native组件,发现在tomcat8.0.44的bin目录下面已经有相关文件tomcat-native.tar.gz
解压后得到tomcat-native-1.2.12-src文件夹
[root@ecs-3c46 bin]# tar -xzvf tomcat-native.tar.gz [root@ecs-3c46 bin]# cd tomcat-native-1.2.12-src/native [root@ecs-3c46 native]# ./configure --with-apr=/usr/local/apr --with-java-home=/usr/local/java/jdk1.7.0_80 --with-ssl=/usr/local/openssl --prefix=/usr/local/tomcat/apache-tomcat-8.0.44 [root@ecs-3c46 native]# make [root@ecs-3c46 native]# make install
5.tomcat配置,默认tomcat8.0.44是启用Apr的,在Listener结点配置
<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
重启tomcat服务后出现一个问题,表示还没有成功使用Apr
27-Jul-2017 15:50:13.488 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
解决方法:
在/usr/java/packages/lib/amd64目录下面创建/usr/local/apr/lib/libtcnative-1.so.0.2.12的链接
[root@ecs-3c46 native]# cd /usr/java/ [root@ecs-3c46 java]# mkdir packages/ [root@ecs-3c46 java]# cd packages/ [root@ecs-3c46 packages]# mkdir lib [root@ecs-3c46 packages]# cd lib [root@ecs-3c46 lib]# mkdir amd64 [root@ecs-3c46 lib]# cd amd64 [root@ecs-3c46 amd64]# ln -s /usr/local/apr/lib/libtcnative-1.so.0.2.12 libtcnative-1.so [root@ecs-3c46 amd64]# ln -s /usr/local/apr/lib/libtcnative--1.so.0.2.12 libtcnative-1.so.0
6.重新启动tomcat,如果显示如下信息就表示已经配置成功了。
27-Jul-2017 16:16:29.479 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.12 using APR version 1.5.2. 27-Jul-2017 16:16:29.479 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 27-Jul-2017 16:16:29.491 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.2l 25 May 2017)
看完了这篇文章,相信你对“Linux下Tomcat8.0.44如何配置使用Apr”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。