chasing鱼 2025-10-31 14:17 采纳率: 37.5%
浏览 5

dubbo2.5.10升级2.7.22版本,该怎么改?

dubbo2.5.10升级2.7.22版本,与dubbo相关联的依赖有哪些需要升级或添加?且版本号是多少?对应的spring配置文件需要有改动吗?
spring配置文件内容:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    <!-- 保留注解驱动配置 -->
    <context:annotation-config/>

    <!-- 导入 CXF 配置(需确保 CXF 版本兼容 Spring 5.3.x) -->
    <import resource="classpath:META-INF/cxf/cxf.xml"/>

    <!-- 组件扫描配置(保持兼容性) -->
    <context:component-scan base-package="com.sinosoft.lis.webservice"/>

    <!-- CXF Bean 定义(需验证类路径兼容性) -->
    <bean id="postprocess" class="org.apache.cxf.jaxws.spring.JaxWsWebServicePublisherBeanPostProcessor">
        <property name="urlPrefix" value="/"/>
    </bean>
</beans>

以下是dubbo配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       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://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd
       http://code.alibabatech.com/schema/dubbo
       http://code.alibabatech.com/schema/dubbo/dubbo.xsd">

    <context:annotation-config/>


    <!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
    <dubbo:application name="consumer"/>

    <!-- 使用zookeeper注册中心暴露服务地址 -->
    <dubbo:registry protocol="zookeeper" address="${dubbo.registry.address}"/>


    <!-- Spring 注解扫描包  -->
    <context:component-scan base-package="com.sinosoft.lis"/>


    <!-- 生成远程服务代理,可以和本地bean一样使用demoService -->
    <dubbo:reference id="claimBackDubboService" interface="com.sinosoft.lis.ClaimBackDubboService" check="false">


        <!--线程池相关参数设置,默认使用同步队列,避免队列过大造成外部等待线程过多造成系统血崩 -->
        <dubbo:parameter key="coreSize" value="${dubbo.fallback.coreSize}"/>
        <dubbo:parameter key="maximumSize" value="${dubbo.fallback.maximumSize}"/>
        <dubbo:parameter key="keepAliveTimeMinutes" value="${dubbo.fallback.keepAliveTimeMinutes}"/>

        <!-- 命令熔断相关配置 -->
        <dubbo:parameter key="requestVolumeThreshold" value="${dubbo.fallback.requestVolumeThreshold}"/>
        <dubbo:parameter key="sleepWindowInMilliseconds" value="${dubbo.fallback.sleepWindowInMilliseconds}"/>
        <!--熔断触发错误率阈值 超过50%错误触发熔断|此值为比例,不要设置成大于100的数字-->
        <dubbo:parameter key="errorThresholdPercentage" value="${dubbo.fallback.errorThresholdPercentage}"/>
        <dubbo:parameter key="timeoutInMilliseconds" value="${dubbo.fallback.timeoutInMilliseconds}"/>

        <!--         需要监控的方法 -->
        <dubbo:method name="service">
            <dubbo:parameter key="fallback" value="claimBackDubboServiceFallBack"/>
        </dubbo:method>

    </dubbo:reference>

    <!--&lt;!&ndash; 生成远程服务代理,可以和本地bean一样使用demoService &ndash;&gt;-->
    <dubbo:reference id="claimSettleDubboService" interface="com.sinosoft.lis.ClaimSettleDubboService" check="false">

        <!--线程池相关参数设置,默认使用同步队列,避免队列过大造成外部等待线程过多造成系统血崩 -->
        <dubbo:parameter key="coreSize" value="${dubbo.fallback.coreSize}"/>
        <dubbo:parameter key="maximumSize" value="${dubbo.fallback.maximumSize}"/>
        <dubbo:parameter key="keepAliveTimeMinutes" value="${dubbo.fallback.keepAliveTimeMinutes}"/>

        <!-- 命令熔断相关配置 -->
        <!--熔断判断请求数阈值 一个统计周期内(默认10秒)请求不少于requestVolumeThreshold才会进行熔断判断 |-->
        <dubbo:parameter key="requestVolumeThreshold" value="${dubbo.fallback.requestVolumeThreshold}"/>
        <!--熔断触发后多久恢复half-open状态 熔断后sleepWindowInMilliseconds毫秒会放入一个请求,如果请求处理成功,熔断器关闭,否则熔断器打开,继续等待sleepWindowInMilliseconds |-->
        <dubbo:parameter key="sleepWindowInMilliseconds" value="${dubbo.fallback.sleepWindowInMilliseconds}"/>
        <!--熔断触发错误率阈值 超过50%错误触发熔断|此值为比例,不要设置成大于100的数字-->
        <dubbo:parameter key="errorThresholdPercentage" value="${dubbo.fallback.errorThresholdPercentage}"/>
        <!--任务执行超时时间     注意该时间和dubbo自己的超时时间不要冲突,以这个时间优先,比如consumer设置3秒,那么当执行时hystrix会提前超时 |-->
        <dubbo:parameter key="timeoutInMilliseconds" value="${dubbo.fallback.timeoutInMilliseconds}"/>

        <!--         需要监控的方法 -->
        <dubbo:method name="service">
            <dubbo:parameter key="fallback" value="claimSettleDubboServiceFallBack"/>
        </dubbo:method>

    </dubbo:reference>

    <!--&lt;!&ndash; 生成远程服务代理,可以和本地bean一样使用demoService &ndash;&gt;-->
    <dubbo:reference id="medicalDubboService" interface="com.sinosoft.lis.MedicalDubboService" check="false">

        <!--线程池相关参数设置,默认使用同步队列,避免队列过大造成外部等待线程过多造成系统血崩 -->
        <dubbo:parameter key="coreSize" value="${dubbo.fallback.coreSize}"/>
        <dubbo:parameter key="maximumSize" value="${dubbo.fallback.maximumSize}"/>
        <dubbo:parameter key="keepAliveTimeMinutes" value="${dubbo.fallback.keepAliveTimeMinutes}"/>

        <!-- 命令熔断相关配置 -->
        <!--熔断判断请求数阈值 一个统计周期内(默认10秒)请求不少于requestVolumeThreshold才会进行熔断判断 |-->
        <dubbo:parameter key="requestVolumeThreshold" value="${dubbo.fallback.requestVolumeThreshold}"/>
        <!--熔断触发后多久恢复half-open状态 熔断后sleepWindowInMilliseconds毫秒会放入一个请求,如果请求处理成功,熔断器关闭,否则熔断器打开,继续等待sleepWindowInMilliseconds |-->
        <dubbo:parameter key="sleepWindowInMilliseconds" value="${dubbo.fallback.sleepWindowInMilliseconds}"/>
        <!--熔断触发错误率阈值 超过50%错误触发熔断|此值为比例,不要设置成大于100的数字-->
        <dubbo:parameter key="errorThresholdPercentage" value="${dubbo.fallback.errorThresholdPercentage}"/>
        <!--任务执行超时时间     注意该时间和dubbo自己的超时时间不要冲突,以这个时间优先,比如consumer设置3秒,那么当执行时hystrix会提前超时 |-->
        <dubbo:parameter key="timeoutInMilliseconds" value="${dubbo.fallback.timeoutInMilliseconds}"/>

        <!--需要监控的方法 -->
        <dubbo:method name="service">
            <!--vlaue值对应channel-access\src\main\resources\META-INF\dubbo\com.netease.hystrix.dubbo.rpc.filter.Fallback修改该文件中路径配置-->
            <dubbo:parameter key="fallback" value="medicalDubboServiceFallBack"/>
        </dubbo:method>
    </dubbo:reference>

    <!-- 生成远程服务代理,可以和本地bean一样使用demoService -->
    <dubbo:reference id="claimCheckDubboService" interface="com.sinosoft.lis.ClaimCheckDubboService" check="false">

        <!--线程池相关参数设置,默认使用同步队列,避免队列过大造成外部等待线程过多造成系统血崩 -->
        <dubbo:parameter key="coreSize" value="${dubbo.fallback.coreSize.claimCheck}"/>
        <dubbo:parameter key="maximumSize" value="${dubbo.fallback.maximumSize.claimCheck}"/>
        <dubbo:parameter key="keepAliveTimeMinutes" value="${dubbo.fallback.keepAliveTimeMinutes.claimCheck}"/>

        <!-- 命令熔断相关配置 -->
        <dubbo:parameter key="requestVolumeThreshold" value="${dubbo.fallback.requestVolumeThreshold.claimCheck}"/>
        <dubbo:parameter key="sleepWindowInMilliseconds"
                         value="${dubbo.fallback.sleepWindowInMilliseconds.claimCheck}"/>
        <!--熔断触发错误率阈值 超过50%错误触发熔断|此值为比例,不要设置成大于100的数字-->
        <dubbo:parameter key="errorThresholdPercentage" value="${dubbo.fallback.errorThresholdPercentage.claimCheck}"/>
        <dubbo:parameter key="timeoutInMilliseconds" value="${dubbo.fallback.timeoutInMilliseconds.claimCheck}"/>

        <!--         需要监控的方法 -->
        <dubbo:method name="service">
            <dubbo:parameter key="fallback" value="claimCheckDubboServiceFallBack"/>
        </dubbo:method>

    </dubbo:reference>

    <!--&lt;!&ndash; 生成远程服务代理,可以和本地bean一样使用demoService &ndash;&gt;-->
    <dubbo:reference id="claimYHsecondSettleDubboService" interface="com.sinosoft.lis.ClaimYHsecondSettleDubboService"
                     check="false">

        <!--线程池相关参数设置,默认使用同步队列,避免队列过大造成外部等待线程过多造成系统血崩 -->
        <dubbo:parameter key="coreSize" value="${dubbo.fallback.coreSize}"/>
        <dubbo:parameter key="maximumSize" value="${dubbo.fallback.maximumSize}"/>
        <dubbo:parameter key="keepAliveTimeMinutes" value="${dubbo.fallback.keepAliveTimeMinutes}"/>

        <!-- 命令熔断相关配置 -->
        <!--熔断判断请求数阈值 一个统计周期内(默认10秒)请求不少于requestVolumeThreshold才会进行熔断判断 |-->
        <dubbo:parameter key="requestVolumeThreshold" value="${dubbo.fallback.requestVolumeThreshold}"/>
        <!--熔断触发后多久恢复half-open状态 熔断后sleepWindowInMilliseconds毫秒会放入一个请求,如果请求处理成功,熔断器关闭,否则熔断器打开,继续等待sleepWindowInMilliseconds |-->
        <dubbo:parameter key="sleepWindowInMilliseconds" value="${dubbo.fallback.sleepWindowInMilliseconds}"/>
        <!--熔断触发错误率阈值 超过50%错误触发熔断|此值为比例,不要设置成大于100的数字-->
        <dubbo:parameter key="errorThresholdPercentage" value="${dubbo.fallback.errorThresholdPercentage}"/>
        <!--任务执行超时时间     注意该时间和dubbo自己的超时时间不要冲突,以这个时间优先,比如consumer设置3秒,那么当执行时hystrix会提前超时 |-->
        <dubbo:parameter key="timeoutInMilliseconds" value="${dubbo.fallback.timeoutInMilliseconds}"/>

        <!-- 需要监控的方法 -->
        <dubbo:method name="service">
            <!--vlaue值对应channel-access\src\main\resources\META-INF\dubbo\com.netease.hystrix.dubbo.rpc.filter.Fallback修改该文件中路径配置-->
            <dubbo:parameter key="fallback" value="claimYHsecondSettleDubboServiceFallBack"/>
        </dubbo:method>

    </dubbo:reference>

    <!--&lt;!&ndash; 生成远程服务代理,可以和本地bean一样使用demoService &ndash;&gt;-->
    <dubbo:reference id="claimYHfastSettleDubboService" interface="com.sinosoft.lis.ClaimYHfastSettleDubboService"
                     check="false">

        <!--线程池相关参数设置,默认使用同步队列,避免队列过大造成外部等待线程过多造成系统血崩 -->
        <dubbo:parameter key="coreSize" value="${dubbo.fallback.coreSize}"/>
        <dubbo:parameter key="maximumSize" value="${dubbo.fallback.maximumSize}"/>
        <dubbo:parameter key="keepAliveTimeMinutes" value="${dubbo.fallback.keepAliveTimeMinutes}"/>

        <!-- 命令熔断相关配置 -->
        <!--熔断判断请求数阈值 一个统计周期内(默认10秒)请求不少于requestVolumeThreshold才会进行熔断判断 |-->
        <dubbo:parameter key="requestVolumeThreshold" value="${dubbo.fallback.requestVolumeThreshold}"/>
        <!--熔断触发后多久恢复half-open状态 熔断后sleepWindowInMilliseconds毫秒会放入一个请求,如果请求处理成功,熔断器关闭,否则熔断器打开,继续等待sleepWindowInMilliseconds |-->
        <dubbo:parameter key="sleepWindowInMilliseconds" value="${dubbo.fallback.sleepWindowInMilliseconds}"/>
        <!--熔断触发错误率阈值 超过50%错误触发熔断|此值为比例,不要设置成大于100的数字-->
        <dubbo:parameter key="errorThresholdPercentage" value="${dubbo.fallback.errorThresholdPercentage}"/>
        <!--任务执行超时时间     注意该时间和dubbo自己的超时时间不要冲突,以这个时间优先,比如consumer设置3秒,那么当执行时hystrix会提前超时 |-->
        <dubbo:parameter key="timeoutInMilliseconds" value="${dubbo.fallback.timeoutInMilliseconds}"/>

        <!--         需要监控的方法 -->
        <dubbo:method name="service">
            <dubbo:parameter key="fallback" value="claimYHsecondSettleDubboServiceFallBack"/>
        </dubbo:method>

    </dubbo:reference>

    <!--&lt;!&ndash; 生成远程服务代理,可以和本地bean一样使用demoService &ndash;&gt;-->
    <dubbo:reference id="claimYHBackDubboService" interface="com.sinosoft.lis.ClaimYHBackDubboService" check="false">

        <!--线程池相关参数设置,默认使用同步队列,避免队列过大造成外部等待线程过多造成系统血崩 -->
        <dubbo:parameter key="coreSize" value="${dubbo.fallback.coreSize}"/>
        <dubbo:parameter key="maximumSize" value="${dubbo.fallback.maximumSize}"/>
        <dubbo:parameter key="keepAliveTimeMinutes" value="${dubbo.fallback.keepAliveTimeMinutes}"/>

        <!-- 命令熔断相关配置 -->
        <!--熔断判断请求数阈值 一个统计周期内(默认10秒)请求不少于requestVolumeThreshold才会进行熔断判断 |-->
        <dubbo:parameter key="requestVolumeThreshold" value="${dubbo.fallback.requestVolumeThreshold}"/>
        <!--熔断触发后多久恢复half-open状态 熔断后sleepWindowInMilliseconds毫秒会放入一个请求,如果请求处理成功,熔断器关闭,否则熔断器打开,继续等待sleepWindowInMilliseconds |-->
        <dubbo:parameter key="sleepWindowInMilliseconds" value="${dubbo.fallback.sleepWindowInMilliseconds}"/>
        <!--熔断触发错误率阈值 超过50%错误触发熔断|此值为比例,不要设置成大于100的数字-->
        <dubbo:parameter key="errorThresholdPercentage" value="${dubbo.fallback.errorThresholdPercentage}"/>
        <!--任务执行超时时间     注意该时间和dubbo自己的超时时间不要冲突,以这个时间优先,比如consumer设置3秒,那么当执行时hystrix会提前超时 |-->
        <dubbo:parameter key="timeoutInMilliseconds" value="${dubbo.fallback.timeoutInMilliseconds}"/>

        <!--         需要监控的方法 -->
        <dubbo:method name="service">
            <dubbo:parameter key="fallback" value="claimYHsecondSettleDubboServiceFallBack"/>
        </dubbo:method>

    </dubbo:reference>

    <dubbo:reference id="ClaimYHCheckDubboService" interface="com.sinosoft.lis.ClaimYHCheckDubboService" check="false">

        <dubbo:parameter key="coreSize" value="${dubbo.fallback.coreSize.claimCheck}"/>
        <dubbo:parameter key="maximumSize" value="${dubbo.fallback.maximumSize.claimCheck}"/>
        <dubbo:parameter key="keepAliveTimeMinutes" value="${dubbo.fallback.keepAliveTimeMinutes.claimCheck}"/>

        <dubbo:parameter key="requestVolumeThreshold" value="${dubbo.fallback.requestVolumeThreshold.claimCheck}"/>
        <dubbo:parameter key="sleepWindowInMilliseconds"
                         value="${dubbo.fallback.sleepWindowInMilliseconds.claimCheck}"/>
        <dubbo:parameter key="errorThresholdPercentage" value="${dubbo.fallback.errorThresholdPercentage.claimCheck}"/>
        <dubbo:parameter key="timeoutInMilliseconds" value="${dubbo.fallback.timeoutInMilliseconds.claimCheck}"/>

        <dubbo:method name="service">
            <!--vlaue值对应channel-access\src\main\resources\META-INF\dubbo\com.netease.hystrix.dubbo.rpc.filter.Fallback修改该文件中路径配置-->
            <dubbo:parameter key="fallback" value="ClaimYHsecondSettleDubboServiceFallBack"/>
        </dubbo:method>

    </dubbo:reference>

<!--
    <dubbo:registry protocol="zookeeper" address="${fxq.dubbo.registry.address}" id = "fxq"/>
    <dubbo:reference id="claimService" interface="com.sinosoft.lis.dubbo.ClaimService" check="false" retries="0" registry="fxq">
        <dubbo:parameter key="coreSize" value="${dubbo.fallback.coreSize}"/>
        <dubbo:parameter key="maximumSize" value="${dubbo.fallback.maximumSize}"/>
        <dubbo:parameter key="keepAliveTimeMinutes" value="${dubbo.fallback.keepAliveTimeMinutes}"/>
        <dubbo:parameter key="requestVolumeThreshold" value="${dubbo.fallback.requestVolumeThreshold}"/>
        <dubbo:parameter key="sleepWindowInMilliseconds" value="${dubbo.fallback.sleepWindowInMilliseconds}"/>
        <dubbo:parameter key="errorThresholdPercentage" value="${dubbo.fallback.errorThresholdPercentage}"/>
        <dubbo:parameter key="timeoutInMilliseconds" value="${dubbo.fallback.timeoutInMilliseconds}"/>
        <dubbo:method name="service">
            <dubbo:parameter key="fallback" value="claimServiceFallBack"/>
        </dubbo:method>
    </dubbo:reference>-->

</beans>


这两个配置文件需要怎么修改?请给出解决方案?

  • 写回答

4条回答 默认 最新

  • 阿里嘎多学长 2025-10-31 14:26
    关注

    阿里嘎多学长整理AIGC生成,因移动端显示问题导致当前答案未能完全显示,请使用PC端查看更加详细的解答过程

    升级 Dubbo 版本需要注意以下几点:

    1. 依赖升级
      • dubbo 本身升级到 2.7.22
      • dubbo-registry 升级到 2.7.22
      • dubbo-remoting 升级到 2.7.22
      • dubbo-annotation 升级到 2.7.22
      • dubbo-spring 升级到 2.7.22
    2. 版本号
      • dubbo:2.7.22
      • dubbo-registry:2.7.22
      • dubbo-remoting:2.7.22
      • dubbo-annotation:2.7.22
      • dubbo-spring:2.7.22
    3. Spring 配置文件改动
      • applicationContext.xmlapplication.properties 中添加以下依赖:
    <!-- dubbo -->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>dubbo</artifactId>
        <version>2.7.22</version>
    </dependency>
    
    <!-- dubbo-registry -->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>dubbo-registry</artifactId>
        <version>2.7.22</version>
    </dependency>
    
    <!-- dubbo-remoting -->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>dubbo-remoting</artifactId>
        <version>2.7.22</version>
    </dependency>
    
    <!-- dubbo-annotation -->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>dubbo-annotation</artifactId>
        <version>2.7.22</version>
    </dependency>
    
    <!-- dubbo-spring -->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>dubbo-spring</artifactId>
        <version>2.7.22</version>
    </dependency>
    
    # dubbo
    dubbo.application.name=你的应用名称
    dubbo.registry.address=你的注册中心地址
    
    1. 注意事项
      • 确保所有依赖的版本号一致
      • 检查配置文件中的 dubbo 配置是否正确
      • 测试应用是否正常运行

    以上是 Dubbo 升级 2.5.10 到 2.7.22 的基本步骤和注意事项。

    评论

报告相同问题?

问题事件

  • 创建了问题 10月31日