运行一个配置了ssl的项目时tomcat老是启动不成功,报错:“requires the APR/native library which is not available”,后来发现是找不到apr的库。web
缺乏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).apache
网上搜索解释:
tomcat native在具体的运行平台上,提供了一种优化技术,它自己是基于APR(Apache Portable Runtime)技术
也就是说,咱们应用了tomcat native技术以后,tomcat在跟操做系统级别的交互方面能够作得更好,而且它更像apache一个,能够更好地做为一台web server。tomcat
下载地址:网络
http://mirrors.cnnic.cn/apache//tomcat/tomcat-connectors/native/1.1.30/binaries/dom
下载第一个,由于里边有咱们须要的dll文件。socket
把tcnative-1.dll文件考到jdk/bin目录或者tomcat/bin(哪一个配置了环境变量就放哪一个里)再运行就能够了。这里须要注意的是要选择版本正确的dll文件,否则会报“Can't load IA 64-bit .dll on a AMD 64-bit platform”的错误,我是64位的系统就用x64文件夹里的dll文件。ide
参考:http://iceeggplant.blog.51cto.com/1446843/1218909性能