Dubbo从2.5.3升级到2.7.5
因为Apache Dubbo框架存在远程代码执行高危漏洞,所以需要升级版本到2.7.5,在升级过程中遇到问题,特此记录。
依赖修改
原来依赖为
1 2 3 4 5
| <dependency> <groupId>com.alibaba</groupId> <artifactId>dubbo</artifactId> <version>2.5.3</version> </dependency>
|
改为
1 2 3 4 5
| <dependency> <groupId>org.apache.dubbo</groupId> <artifactId>dubbo</artifactId> <version>2.7.5</version> </dependency>
|
import 包修改
如果有使用dubbo包中的一些工具类:StringUtils、CollectionUtils等,需要修改import包路径
启动报错
1
| NoClassDefFoundError: org/apache/curator/RetryPolicy
|
解决办法
添加依赖
1 2 3 4 5 6
| <dependency> <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-dependencies-zookeeper</artifactId> <version>${dubbo.version}</version> <type>pom</type> </dependency>
|
xml配置修改
原来
1 2 3 4 5
| <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
|
改为
1 2 3 4 5
| <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://dubbo.apache.org/schema/dubbo" xmlns="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
|