Dubbo 3.0.3 + Nacos 2.0.3 + spring boot 2.3.6.RELEASE integration
Because some of the company's old projects use rpc (a call toolkit encapsulated by HTTP client), considering the low performance, it is extremely difficult to maintain. Through comparison among many rpc frameworks, it is found that dubbo has launched version 3.0, and at present, all major enterprises use dubbo as the rpc framework. Therefore, the existing rpc was overthrown and dubbo 3.0.3 was used to replace the rpc framework in the project. After reading major websites and forums, it was found that dubbo 2.0 In version x, zookeeper is still used as the rpc registry. After studying spring cloud version h, I found that nacos is also a good choice as the service registry, so this upgrade also adopts nacos 2.0
Project framework construction
Service provider
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 Interface definition --> <dependency> <groupId>org.example</groupId> <artifactId>demo-interface</artifactId> <version>1.0.0-SNAPSHOT</version> </dependency> <!-- spring boot Related Toolkit --> <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 integrate --> <dependency> <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-spring-boot-starter</artifactId> <version>${dubbo.version}</version> </dependency> <!-- ubbo-registry-nacos The secondary package has been associated with nacos2.0.3 Integration, so it is not necessary to import nacos-client My bag --> <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 Database connection pool--> <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> <!--Hot deployment plug-in--> <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 # Configure the time to get the connection wait timeout maxWait: 60000 # Configure how often to detect idle connections that need to be closed. The unit is milliseconds timeBetweenEvictionRunsMillis: 60000 # Configure the minimum lifetime of a connection in the pool, in milliseconds minEvictableIdleTimeMillis: 300000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false testOnReturn: false # Open PSCache and specify the size of PSCache on each connection poolPreparedStatements: true maxPoolPreparedStatementPerConnectionSize: 20 # Configure the filters for monitoring statistics interception. After removal, the sql in the monitoring interface cannot be counted, 'wall' is used for firewall filters: stat,wall,slf4j # Open the mergeSql function through the connectProperties property; Slow SQL record connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 dubbo: application: name: dubbo-demo-provider # When QOS is disabled, port conflicts may occur on the same machine qos-enable: false qos-accept-foreign-ip: false scan: # Scan rpc interface definition package base-packages: org.example.demo.service protocol: name: dubbo port: 8888 registry: protocol: dubbo address: nacos://127.0.0.1:8848 # Set timeout timeout: 3000 # Configure namespace parameters: namespace: 88b66463-1685-40b3-ba9c-7b25e526dcfb # Service grouping group: demo mybatis-plus: mapper-locations: classpath:/mapper/**Mapper.xml type-aliases-package: org.example.demo.entity #Package of all Entity alias classes configuration: log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl logging: level: org.example.demo: debug
DemoServiceImpl.java
@Slf4j @DubboService(version = "1.0") public class DemoServiceImpl implements DemoService{ @Override public String test() { log.info("Hello Word"); return "Hello Word"; } }
Service consumers
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 integrate --> <dependency> <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-spring-boot-starter</artifactId> <version>${dubbo.version}</version> </dependency> <!-- Nacos rely on --> <dependency> <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-registry-nacos</artifactId> <version>${dubbo.version}</version> </dependency> <!--Hot deployment plug-in--> <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> <!-- The main startup class of the program, i.e@SpringBootApplication Annotations, including main Class of method --> <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: # Solve the problem of Bean duplicate definition allow-bean-definition-overriding: true jackson: time-zone: GMT+8 date-format: yyyy-MM-dd HH:mm:ss dubbo: application: name: dubbo-demo-consumer # When QOS is disabled, port conflicts may occur on the same machine qos-enable: false qos-accept-foreign-ip: false registry: address: nacos://127.0.0.1:8848 # Configure namespace parameters: namespace: 88b66463-1685-40b3-ba9c-7b25e526dcfb use-as-metadata-center: false use-as-config-center: false // Service grouping group: demo consumer: # Service connection timeout timeout: 3000 # Cancel service startup check check: false logging: level: org.example.demo: debug
ConsumerService.java
@Slf4j @Service public class ConsumerService{ @DubboReference( version = "1.0", loadbalance = "roundrobin" ) private DemoService demoService; /** * Complete the service call here */ public void test() { try { String msg = demoService.test(); log.info("rpc The data obtained by calling is:{}", msg) } catch (RpcException e) { log.error("rpc Calling data failed with error message:", e); } return null; } }
There are no special requirements. So far, the configuration is completed and you can play happily
Duplicate class org/apache/dubbo/remoting/exchange/Exchangers.class in 2 jar
Duplicate class org/apache/dubbo/common/Version.class in 2 jar
Due to a recently popular log (log4j and log4j2) fatal vulnerability, it is necessary to repair the log4j related vulnerability in the production project. Originally, I laughed secretly after I first knew the log4j2 vulnerability, because the projects affected by this vulnerability use log4j2 related jar s, such as spring boot starter log4j2 related dependencies, But I didn't use log4j2 in my project, so I congratulated myself. Spring MVC 4.2.8 is used in older projects, slf4j+log4j is used as the log component, and the official log component library logback is used in spring boot projects. However, not long after the log4j2 vulnerability appeared, log4j also exploded, so it had to be upgraded...
logback vulnerability: https://mp.weixin.qq.com/s/y10RXst0gRNZzmLyRt0GYA
To enter the topic, first of all, the logback used by spring boot 2.3.6 is 1.2.3, which needs to be upgraded to the latest stable version 1.2.9
Check the key for the current dependent version specified in spring boot dependencies.
Rewrite the configuration in the current project, such as the following code, to replace the default version number.
<properties> <logback.version>1.2.9</logback.version> </properties>
After the replacement, it is found that there are log4j packages in the project. After checking the dependencies, it is found that log4j 1.2.6 is used in Dubbo registry Nacos, which is removed in the pom of the current project
<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>
The project was started and an error message was found
First error
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 :
Second error
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
resolvent:
When dubbo related dependencies are introduced, there will be dependency delivery, and the conflicting resources must be exclude d
reference resources: 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.
Removing log4j causes a dubbo startup error
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]
Resolve metadata report initialization error:
Modify project application yml
dubbo: registry: address: nacos://127.0.0.1:8848 # Configuring dubbo metadata metadata-report: address: nacos://127.0.0.1:8848 group: demo
The metadata center is used to store some information about service providers and consumers, such as dubbo version, service interface information (including method name, formal parameter table, return value type), etc.