dubbo本地直连一个程序既当提供者又当消费者问题

依赖


 <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.7.18</version>
    <relativePath/>
 </parent>
 
 <properties>
    <java.version>1.8</java.version>
    <dubbo.version>2.7.23</dubbo.version>
  </properties>

  <dependencies>
    <!-- Spring Boot Web -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <!-- Dubbo Spring Boot Starter -->
    <dependency>
      <groupId>org.apache.dubbo</groupId>
      <artifactId>dubbo-spring-boot-starter</artifactId>
      <version>${dubbo.version}</version>
    </dependency>

问题1:20880端口没有监听
解决1:registry-address: N/A
application.yml

dubbo:
  protocol:
    name: dubbo
    port: 20880  
  registry:
    address: N/A  # 不使用注册中心,直连提供者

问题2:没有进行序列化和反序列化
解决2: @DubboReference中 injvm= false // 禁用 In-JVM

 // 关键:使用 url 指定直连地址
 @DubboReference(
         url = "dubbo://127.0.0.1:20880/com.wc88.dubbo.service.GreetingService",
         check = false,  // 启动时不检查
         injvm=  false
 ) // Dubbo 的 @Reference
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值