This is the 7th day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021.

Note the problem with Spring-cloud-Alibaba, which was finally resolved a few days ago.

Problem description

Now the project uses the Spring-Cloud-Alibaba framework, and the specific version is as follows

  • Spring Cloud 2020.0.1.
  • Spring Boot 2.4.2.
  • Spring Cloud Alibaba, 2021.1

Today we’re going to add dubbo calls. As a result, reference documents to write

Spring-cloud ://localhost Dubo.registry. Address =spring-cloud://localhostCopy the code

Then start the project, the project error is as follows

The 2021-11-11 08:27:40. 551 ERROR [mainraceId] [the main] org. Springframework. Boot. SpringApplication - Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'noteController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'noteServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'noteManagerImpl': Injection of @DubboReference dependencies is failed; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.qlteacher.service.NotePublicService. No provider available for the service  com.qlteacher.service.NotePublicService from the url spring-cloud://localhost:9090/org.apache.dubbo.registry.RegistryService? Application = learning&dubbo = 2.0.2 & init = false&interface = com. Qlteacher. Service. NotePublicService&methods = editNoteLikeCount, AddNote gatherNoteCount, editNote queryNoteList, editNotePublic, removeNote&pid = 10524 & qos. Enable = false&register. IP = 192.168. 100.61&release=2.7.8&revision=1.0.12&side= Consumer&sticky =false&timestamp=1636590460047 to the consumer 192.168.100.61 Use Dubbo version 2.7.8 at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostP Rocessor. Java: 321) ~ [spring - the context - 5.3.3. Jar: 5.3.3] the at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFac Tory. Java: 1415) ~ [spring - beans - 5.3.3. Jar: 5.3.3] the at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFac Tory. Java: 608) ~ [spring - beans - 5.3.3. Jar: 5.3.3] the at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFacto Ry. Java: 531) ~ [spring - beans - 5.3.3. Jar: 5.3.3] the at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~ [spring beans - 5.3.3. Jar: 5.3.3] the at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:23 (4) ~ [spring - beans - 5.3.3. Jar: 5.3.3] the at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~ [spring beans - 5.3.3. Jar: 5.3.3] the at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~ [spring beans - 5.3.3. Jar: 5.3.3] the at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory .java: 944) ~ [spring - beans - 5.3.3. Jar: 5.3.3] the at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContex T.j ava: 923) ~ [spring - the context - 5.3.3. Jar: 5.3.3] the at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588) ~ [spring - the context - 5.3.3. Jar: 5.3.3] the at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationConte Xt. Java: 144) ~ [spring - the boot - 2.4.2. Jar:] 2.4.2 ats Org. Springframework. Boot. SpringApplication. Refresh (SpringApplication. Java: 767) ~ [spring - the boot - 2.4.2. Jar:] 2.4.2 ats Org. Springframework. Boot. SpringApplication. Refresh (SpringApplication. Java: 759) ~ [spring - the boot - 2.4.2. Jar:] 2.4.2 ats Org. Springframework. Boot. SpringApplication. RefreshContext (SpringApplication. Java: 426) ~ [spring - the boot - 2.4.2. Jar:] 2.4.2 ats Org. Springframework. Boot. SpringApplication. Run (SpringApplication. Java: 326) ~ [spring - the boot - 2.4.2. Jar:] 2.4.2 ats Org. Springframework. Boot. SpringApplication. Run (SpringApplication. Java: 1311) ~ [spring - the boot - 2.4.2. Jar:] 2.4.2 ats Org. Springframework. Boot. SpringApplication. Run (SpringApplication. Java: 1300) ~ [spring - the boot - 2.4.2. Jar:] 2.4.2 ats com.qlteacher.RunLearning.main(RunLearning.java:21) ~[main/:?]Copy the code

Looking for the answer 1

At this time I panic, can not dubbo call, how to cross with the above ah, so I went to github Issues to find the answer: No provider available from registry localhost:9090 for service XXX/com. Alibaba. Cloud. Dubbo. Service. DubboMetadataService: 1.0.0 on consumer 172.26.160.1 use dubbo version 2.7.8, please check status of providers(disabled, Not registered or in blacklist). · Issue #2274 · Alibaba/Spring-cloud-Alibaba (github.com)

The following answer is also unsolvable

So I searched again and finally found a solution

dubbo.registry.address=nacos://ip:8848

Copy the code

Sure enough, it was good to try, so I took it for granted that I had solved the problem by now

Looking for the answer 2

A few weeks later, just last week, I tried using the Feign call: see the previous article. Not at first. So I did some Internet searches and came across an article that said to see if the NACOS registry is in a namespace and in a group.

I looked at nacOS and found the problem. I had two services in the same namespace but not in the same group, so I deleted all the groups and all DEFAULT_GROUP.

Sure enough, there you go

So, I thought of the previous problem, wondering if this problem caused, so I changed back

dubbo.registry.address=spring-cloud://localhost
Copy the code

A moment of wonder

All right!

I was so excited. At the time.

conclusion

The problem is solved, indicating that the problem is still used by myself using nacOS without full understanding. If you have this problem, don’t hesitate to change it