Tomcat7 配置 ssl

时间:2023-03-08 17:13:24

运行一个配置了ssl的项目时tomcat总是启动不成功,报错:“requires the APR/native library which is not available”,后来发现是找不到apr的库。

缺少apr的支持: 
Tomcat Native 是利用 APR 来提升Tomcat性能的本地API
Tomcat Native 这个项目可以让 Tomcat 使用 Apache 的 apr 包来处理包括文件和网络IO操作,以提升性能。
以下是tomcat官网搜索说明:
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).

网上搜索解释:
tomcat native在具体的运行平台上,提供了一种优化技术,它本身是基于APR(Apache Portable Runtime)技术
也就是说,我们应用了tomcat native技术之后,tomcat在跟操作系统级别的交互方面可以做得更好,并且它更像apache一个,可以更好地作为一台web server。

下载地址:

http://mirrors.cnnic.cn/apache//tomcat/tomcat-connectors/native/1.1.30/binaries/

下载第一个,因为里边有我们需要的dll文件。

把tcnative-1.dll文件考到jdk/bin目录或者tomcat/bin(哪个配置了环境变量就放哪个里)再运行就可以了。这里需要注意的是要选择版本正确的dll文件,不然会报“Can't load IA 64-bit .dll on a AMD 64-bit platform”的错误,我是64位的系统就用x64文件夹里的dll文件。

参考:http://iceeggplant.blog.51cto.com/1446843/1218909