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

依赖

xml 复制代码
 <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
相关推荐
小信丶2 天前
@Activate 注解详解:应用场景与实战示例
java·spring boot·后端·spring·spring cloud·微服务·dubbo
不像程序员的程序媛2 天前
nacos作为dubbo服务注册中心
dubbo
BraveHeart!5 天前
@DubboService 与 @DubboReference 初始化过程
dubbo
信创天地6 天前
从 “替代” 到 “超越”:信创系统架构师如何筑牢自主可控技术底座
运维·安全·系统架构·开源·dubbo·risc-v
wniuniu_6 天前
运维运维运维
java·运维·dubbo
量子炒饭大师7 天前
【C++入门】Cyber骇客构造器的核心六元组 —— 【类的默认成员函数】明明没写构造函数也能跑?保姆级带你掌握六大类的默认成员函数(上:函数篇)
开发语言·c++·dubbo·默认成员函数
信创天地7 天前
信创运维核心技术:国产化软硬件适配与故障排查全解析
运维·人工智能·开源·dubbo·运维开发·risc-v
bing.shao8 天前
文心大模型 5.0 正式版上线:用 Golang 解锁全模态 AI 工业化落地新路径
人工智能·golang·dubbo
小冷coding10 天前
【Java】Dubbo 与 OpenFeign 的核心区别
java·开发语言·dubbo