Dubbo 3.0.3 + Nacos 2.0.3 + spring boot 2.3.6.RELEASE 整合中遇到的问题
Dubbo 3.0.3 + Nacos 2.0.3 + spring boot 2.3.6.RELEASE 整合
由于公司的一些老项目使用的rpc(是由HTTPClient封装的一个调用工具包),考虑到性能低,维护起来又极其难受。在众多rpc框架中对比发现,加上dubbo又推出了3.0版本,再加上目前各大企业都是采用dubbo作为rpc框架。故推翻现有的rpc,采用dubbo 3.0.3 来替换项目中的rpc框架,阅读各大网站、论坛,帖子发现dubbo 2.x版大多数使用的还是zookeeper作为rpc的注册中心,由于之前学习过spring cloud H版后发现 nacos 做为服务注册中心也是一个很不错的选择,所以此次升级也是采用了nacos 2.0
项目框架搭建
服务提供者
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>demo-provider</artifactId>
<version>1.0.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.3.6.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>2.3.6.RELEASE</spring-boot.version>
<mybatis-plus-spring-boot.version>3.4.1</mybatis-plus-spring-boot.version>
<druid-spring-boot.version>1.1.21</druid-spring-boot.version>
<mysql.version>5.1.47</mysql.version>
<dubbo.version>3.0.3</dubbo.version>
<logback.version>1.2.9</logback.version>
</properties>
<dependencies>
<!-- dubbo rpc 接口定义 -->
<dependency>
<groupId>org.example</groupId>
<artifactId>demo-interface</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<!-- spring boot 相关工具包 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<!-- dubbo spring boot集成 -->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>${dubbo.version}</version>
</dependency>
<!-- ubbo-registry-nacos 次包已与nacos2.0.3 集成,故不需要在导入nacos-client的包 -->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-registry-nacos</artifactId>
<version>${dubbo.version}</version>
</dependency>
<!--MySQL 5.1.47-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!--druid 数据库连接池-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid-spring-boot.version}</version>
</dependency>
<!-- mybatis plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus-spring-boot.version}</version>
</dependency>
<!--热部署插件-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<finalName>demo-provider</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
<mainClass>org.example.DemoApplication</mainClass>
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
application.yml
server:
port: 8080
spring:
application:
name: dubbo-demo-provider
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/demo?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8&autoReconnect=true&autoReconnectForPools=true&useSSL=false
username: root
password: 123456
druid:
initialSize: 5
minIdle: 5
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache,并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
filters: stat,wall,slf4j
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
dubbo:
application:
name: dubbo-demo-provider
# 禁用QOS同一台机器可能会有端口冲突现象
qos-enable: false
qos-accept-foreign-ip: false
scan:
# 扫描rpc接口定义包
base-packages: org.example.demo.service
protocol:
name: dubbo
port: 8888
registry:
protocol: dubbo
address: nacos://127.0.0.1:8848
# 设置超时时间
timeout: 3000
# 配置 namespace
parameters:
namespace: 88b66463-1685-40b3-ba9c-7b25e526dcfb
# 服务分组
group: demo
mybatis-plus:
mapper-locations: classpath:/mapper
DemoServiceImpl.java
@Slf4j
@DubboService(version = "1.0")
public class DemoServiceImpl implements DemoService{
@Override
public String test() {
log.info("Hello Word");
return "Hello Word";
}
}
服务消费者
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>demo-consumer</artifactId>
<version>1.0.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.3.6.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<dubbo.version>3.0.3</dubbo.version>
<logback.version>1.2.9</logback.version>
</properties>
<dependencies>
<dependency>
<groupId>org.example</groupId>
<artifactId>demo-interface</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<!-- dubbo spring boot集成 -->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>${dubbo.version}</version>
</dependency>
<!-- Nacos依赖 -->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-registry-nacos</artifactId>
<version>${dubbo.version}</version>
</dependency>
<!--热部署插件-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>demo-consumer</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- 程序的主启动类,即:用@SpringBootApplication注解,包含main方法的类 -->
<mainClass>org.example.demo.DemoApiApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
application.yml
server:
port: 8181
spring:
application:
name: dubbo-demo-consumer
main:
# 解决Bean重复定义问题
allow-bean-definition-overriding: true
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
dubbo:
application:
name: dubbo-demo-consumer
# 禁用QOS同一台机器可能会有端口冲突现象
qos-enable: false
qos-accept-foreign-ip: false
registry:
address: nacos://127.0.0.1:8848
# 配置 namespace
parameters:
namespace: 88b66463-1685-40b3-ba9c-7b25e526dcfb
use-as-metadata-center: false
use-as-config-center: false
group: demo
consumer:
# 服务连接超时时间
timeout: 3000
# 取消服务启动检查
check: false
logging:
level:
org.example.demo: debug
ConsumerService.java
@Slf4j
@Service
public class ConsumerService{
@DubboReference(
version = "1.0",
loadbalance = "roundrobin"
)
private DemoService demoService;
public void test() {
try {
String msg = demoService.test();
log.info("rpc 调用获取到的数据为:{}", msg)
} catch (RpcException e) {
log.error("rpc 调用数据失败,错误信息为:", e);
}
return null;
}
}
没有啥特殊要求,至此配置完成,可以愉快的玩耍了
Duplicate class org/apache/dubbo/remoting/exchange/Exchangers.class in 2 jar
Duplicate class org/apache/dubbo/common/Version.class in 2 jar
由于最近很火的一个日志(log4j和log4j2)致命漏洞,需要将生产项目中log4j相关漏洞进行修复,本来在最初知道 log4j2 的漏洞后还暗自笑过,因为受这个漏洞影响的项目中是使用了log4j2相关的jar,比如常见的在项目中应用了 spring-boot-starter-log4j2 相关的依赖,但是我的项目中没有使用到log4j2,所以暗自庆幸了一下。因为比较旧的项目采用的spring-mvc 4.2.8,日志组件采用slf4j+log4j,spring-boot项目则是采用了官方的日志组件库 logback。但是紧跟着log4j2 漏洞出现后没过多久,log4j也暴雷了,所以得升级改造。。。
logback 漏洞: https://mp.weixin.qq.com/s/y10RXst0gRNZzmLyRt0GYA
进入主题,首先spring-boot 2.3.6 使用的 logback是1.2.3,需要升级到最新稳定版本 1.2.9 查看spring-boot-dependencies里面规定当前依赖的版本 用的 key。 在当前项目里面重写配置,如下面的代码,则可以替代默认的版本号。
<properties>
<logback.version>1.2.9</logback.version>
</properties>
替换完之后发现项目中还有log4j的包,查看依赖后发现是 dubbo-registry-nacos 中使用到了log4j 1.2.6,在当前项目pom中进行移除
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-registry-nacos</artifactId>
<version>${dubbo.version}</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
启动项目,发现了错误信息 第一处错误
2021-12-31 16:39:24.633 ERROR 7440 --- [ restartedMain] org.apache.dubbo.common.Version : [DUBBO] Duplicate class org/apache/dubbo/common/Version.class in 2 jar [file:/F:/repository/org/apache/dubbo/dubbo/3.0.3/dubbo-3.0.3.jar!/org/apache/dubbo/common/Version.class, file:/F:/repository/org/apache/dubbo/dubbo-common/3.0.3/dubbo-common-3.0.3.jar!/org/apache/dubbo/common/Version.class], dubbo version: 3.0.3, current host: 192.168.28.1
2021-12-31 16:39:24.638 INFO 7440 --- [ restartedMain] d.s.b.c.e.WelcomeLogoApplicationListener :
第二处错误
2021-12-31 16:39:32.886 WARN 7440 --- [ restartedMain] o.a.d.r.c.r.mesh.route.MeshRuleManager : [DUBBO] Doesn't support Configuration!, dubbo version: 3.0.3, current host: 192.168.28.1
2021-12-31 16:39:32.897 ERROR 7440 --- [ restartedMain] org.apache.dubbo.common.Version : [DUBBO] Duplicate class org/apache/dubbo/remoting/exchange/Exchangers.class in 2 jar [file:/F:/repository/org/apache/dubbo/dubbo/3.0.3/dubbo-3.0.3.jar!/org/apache/dubbo/remoting/exchange/Exchangers.class, file:/F:/repository/org/apache/dubbo/dubbo-remoting-api/3.0.3/dubbo-remoting-api-3.0.3.jar!/org/apache/dubbo/remoting/exchange/Exchangers.class], dubbo version: 3.0.3, current host: 192.168.28.1
2021-12-31 16:39:32.908 ERROR 7440 --- [ restartedMain] org.apache.dubbo.common.Version : [DUBBO] Duplicate class org/apache/dubbo/remoting/Transporters.class in 2 jar [file:/F:/repository/org/apache/dubbo/dubbo/3.0.3/dubbo-3.0.3.jar!/org/apache/dubbo/remoting/Transporters.class, file:/F:/repository/org/apache/dubbo/dubbo-remoting-api/3.0.3/dubbo-remoting-api-3.0.3.jar!/org/apache/dubbo/remoting/Transporters.class], dubbo version: 3.0.3, current host: 192.168.28.1
2021-12-31 16:39:32.908 ERROR 7440 --- [ restartedMain] org.apache.dubbo.common.Version : [DUBBO] Duplicate class org/apache/dubbo/remoting/RemotingException.class in 2 jar [file:/F:/repository/org/apache/dubbo/dubbo-remoting-api/3.0.3/dubbo-remoting-api-3.0.3.jar!/org/apache/dubbo/remoting/RemotingException.class, file:/F:/repository/org/apache/dubbo/dubbo/3.0.3/dubbo-3.0.3.jar!/org/apache/dubbo/remoting/RemotingException.class], dubbo version: 3.0.3, current host: 192.168.28.1
解决方法: 引入dubbo相关的依赖时,会有依赖传递,必须要exclude相关冲突的资源 参考:https://github.com/apache/dubbo-spring-boot-project/issues/227
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-registry-nacos</artifactId>
<version>${dubbo.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-remoting-api</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
[dubbo] the metadata report was not initialized.
去掉log4j 导致 dubbo 启动错误
2021-12-31 16:39:33.247 WARN 7440 --- [ restartedMain] o.a.d.r.client.ServiceDiscoveryRegistry : [DUBBO] Cannot find app mapping for service tm.ucp.service.MeetingRecordingService, will not migrate., dubbo version: 3.0.3, current host: 192.168.28.1
java.lang.IllegalStateException: the metadata report was not initialized.
at org.apache.dubbo.metadata.report.MetadataReportInstance.checkInit(MetadataReportInstance.java:88) ~[dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.metadata.report.MetadataReportInstance.getMetadataReport(MetadataReportInstance.java:77) ~[dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.client.metadata.MetadataServiceNameMapping.getAndListen(MetadataServiceNameMapping.java:107) ~[dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.metadata.AbstractServiceNameMapping.getAndListenServices(AbstractServiceNameMapping.java:101) ~[dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.doSubscribe(ServiceDiscoveryRegistry.java:215) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.subscribe(ServiceDiscoveryRegistry.java:204) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.ListenerRegistryWrapper.subscribe(ListenerRegistryWrapper.java:109) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.integration.DynamicDirectory.subscribe(DynamicDirectory.java:160) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.client.ServiceDiscoveryRegistryDirectory.subscribe(ServiceDiscoveryRegistryDirectory.java:104) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.integration.RegistryProtocol.doCreateInvoker(RegistryProtocol.java:557) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.integration.InterfaceCompatibleRegistryProtocol.getServiceDiscoveryInvoker(InterfaceCompatibleRegistryProtocol.java:65) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.client.migration.MigrationInvoker.refreshServiceDiscoveryInvoker(MigrationInvoker.java:424) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.client.migration.MigrationInvoker.migrateToApplicationFirstInvoker(MigrationInvoker.java:240) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.client.migration.MigrationRuleHandler.refreshInvoker(MigrationRuleHandler.java:72) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.client.migration.MigrationRuleHandler.doMigrate(MigrationRuleHandler.java:56) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.client.migration.MigrationRuleListener.onRefer(MigrationRuleListener.java:233) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.integration.RegistryProtocol.interceptInvoker(RegistryProtocol.java:526) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:495) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:480) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.qos.protocol.QosProtocolWrapper.refer(QosProtocolWrapper.java:83) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:74) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.rpc.cluster.filter.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:71) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.rpc.protocol.ProtocolSerializationWrapper.refer(ProtocolSerializationWrapper.java:52) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.config.ReferenceConfig.createInvokerForRemote(ReferenceConfig.java:469) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:380) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:267) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:204) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.config.spring.ReferenceBean.getCallProxy(ReferenceBean.java:348) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.config.spring.ReferenceBean.access$100(ReferenceBean.java:98) [dubbo-3.0.3.jar:3.0.3]
at org.apache.dubbo.config.spring.ReferenceBean$DubboReferenceLazyInitTargetSource.createObject(ReferenceBean.java:355) [dubbo-3.0.3.jar:3.0.3]
at org.springframework.aop.target.AbstractLazyCreationTargetSource.getTarget(AbstractLazyCreationTargetSource.java:88) [spring-aop-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:192) [spring-aop-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at com.sun.proxy.$Proxy142.listByUntreated(Unknown Source) [na:na]
at tm.mye.mobile.rpc.server.GroupMeetingServiceImpl.getMeetingRecordingByUntreated(GroupMeetingServiceImpl.java:192) [classes/:na]
at tm.mye.mobile.uap.server.TaskService.scheduleTask(TaskService.java:41) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:415) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeanByName(AbstractAutowireCapableBeanFactory.java:453) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:527) ~[spring-context-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:497) ~[spring-context-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:650) ~[spring-context-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:229) ~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:318) ~[spring-context-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeanByName(AbstractAutowireCapableBeanFactory.java:453) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:527) ~[spring-context-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:497) ~[spring-context-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:650) ~[spring-context-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:229) ~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:318) ~[spring-context-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) [spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405) ~[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
at tm.mye.mobile.MobileApiApplication.main(MobileApiApplication.java:20) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.3.6.RELEASE.jar:2.3.6.RELEASE]
解决metadata report 初始化错误: 修改项目 application.yml
dubbo:
registry:
address: nacos://127.0.0.1:8848
# 配置dubbo 元数据
metadata-report:
address: nacos://127.0.0.1:8848
group: demo
元数据中心用于存储一些服务提供者、消费者的信息,比如dubbo版本、服务接口的信息(包括方法名、形参表、返回值类型)等等。
|