Timbo Site

write something


Spring Boot 2.0在Windows 7系统下运行持续报错的解决方案

昨天Spring Boot 2.0正式发布,Milestone和RC版本用了很长时间,在自己的macOS机器上开发一直没啥问题

昨天新项目启动,直接用了Spring Boot 2.0,代码提交上去,同事在Windows 7的机器检出下来,运行时抛了一堆错误:

2018-03-01 20:34:45.025 ERROR 9632 --- [nio-8080-exec-1] o.a.catalina.core.AprLifecycleListener  : An incompatible version [1.1.33] of the APR based Apache Tomcat Native library is installed, while Tomcat requires version [1.2.14]
2018-03-01 20:34:45.025 ERROR 9632 --- [nio-8080-exec-1] o.a.catalina.core.AprLifecycleListener  : An incompatible version [1.1.33] of the APR based Apache Tomcat Native library is installed, while Tomcat requires version [1.2.14]

由于一直在macOS、Linux环境下进行开发,一直用Undertow也没用Tomcat,没遇到这种问题,也只知道Spring Boot 2.0把Tomcat升级到了8.5.28,不太懂APR based Apache Tomcat Native library是什么东西,跑去官网查了一下,有个专门的APR页面,APR全称为Apache Portable Runtime(Apache可移植运行时),封装了一层,抹平不同操作系统平台的差异,对外提供稳定的接口,Tomcat Native用APR来调用各类系统级文件、网络接口提供更高的性能和更佳的稳定性,针对Windows里面说:

Windows binaries are provided for tcnative-1, which is a statically compiled .dll which includes OpenSSL and APR. It can be downloaded from here as 32bit or AMD x86-64 binaries. In security conscious production environments, it is recommended to use separate shared dlls for OpenSSL, APR, and libtcnative-1, and update them as needed according to security bulletins. Windows OpenSSL binaries are linked from the Official OpenSSL website (see related/binaries).

要到下载页面,找到适用于Windows的dll(Binaries for Microsoft Windows)下载回来扔到Windows/System 和 Windows/SysWOW64,就好了

实际上把容器换成Undertow或者Jetty就好了用什么Tomcat