Closed LiHanGod closed 3 years ago
Is it related with spring-boot-devtools?
I took it out spring-boot-devtools
pom.xml
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com</groupId>
<artifactId>stu-alibaba</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>cloudalibaba-consumer-nacos-order83</artifactId>
<dependencies>
<!--SpringCloud ailibaba nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</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-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>
</project>
this is run log:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.12.RELEASE)
2021-01-08 09:27:17.481 INFO 6048 --- [ main] com.OrderNacosMain83 : No active profile set, falling back to default profiles: default
2021-01-08 09:27:20.920 WARN 6048 --- [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'nacos-discovery' contains invalid characters, please migrate to a valid format.
2021-01-08 09:27:21.236 WARN 6048 --- [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2021-01-08 09:27:21.507 INFO 6048 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=a1add1cf-819c-3286-b6c6-0fc1ad17e13b
2021-01-08 09:27:22.122 INFO 6048 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 83 (http)
2021-01-08 09:27:22.145 INFO 6048 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-01-08 09:27:22.146 INFO 6048 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41]
2021-01-08 09:27:22.409 INFO 6048 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-01-08 09:27:22.410 INFO 6048 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 4894 ms
2021-01-08 09:27:22.802 WARN 6048 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ribbonServerList' defined in class path resource [com/alibaba/cloud/nacos/ribbon/NacosRibbonClientConfiguration.class]: Unsatisfied dependency expressed through method 'ribbonServerList' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.netflix.client.config.IClientConfig' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2021-01-08 09:27:22.808 INFO 6048 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2021-01-08 09:27:22.849 INFO 6048 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-01-08 09:27:23.134 ERROR 6048 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method ribbonServerList in com.alibaba.cloud.nacos.ribbon.NacosRibbonClientConfiguration required a bean of type 'com.netflix.client.config.IClientConfig' that could not be found.
Action:
Consider defining a bean of type 'com.netflix.client.config.IClientConfig' in your configuration.
参考如下原因
是否可以提供一个简单的demo以供复现你的问题?
我写了一个demo spring-cloud: Hoxton.SR9 spring-boot: 2.2.12.RELEASE spring-cloud-alibaba: 2.2.3.RELEASE JDK:15.0.1 按照手册应该是版本对齐了 这个demo没有添加自定义的配置,只有一个启动类,启动还是会有这个问题 demo
无法查看查看你的压缩文件,是否直接提供github地址?
还有一个,盲猜,是否跟java 15这么高的版本有关系?我们一般都是在java8下验收的
我使用了JDK1.8进行测试,依然同样的错误 这个是项目的Git地址 https://github.com/LiHanGod/cloud-alibaba-demo
Spring Boot版本升级到2.3.8.RELEASE试试,怀疑SR9不支持2.2
我使用1.8JDK测试Spring Boot 2.3.8.RELEASE,一样😂 单层级的包名就会有问题,多层级的包名就不会有问题,应该不是配置问题了
我的Git已经提交了
大概知道原因了,你的包名用com,应该是不行的,换成com.abc
如果把com作为包名,它会以com作为扫描目录,不仅会增加扫描配置,也会遇到意想不到的问题。建议写demo.业尽量严谨一些
单层级的包名是可以的了,我刚才改成abc的包名,确实可以启动,使用com是不行的,好的谢谢了
单层级的包名是可以的了,我刚才改成abc的包名,确实可以启动,使用com是不行的,好的谢谢了
这个错误的原因是什么 我也刚刚遇到这个问题
我也遇到了这个问题,之前写的是com.alibaba包名,改掉就可以了
Describe the bug Package name hierarchy problem,com or com.xxxx
Using the com hierarchy![com包名](https://raw.githubusercontent.com/LiHanGod/saveData/master/com%E5%8C%85%E5%90%8D.png)
Using the com.xxxx hierarchy![com.xxx包名](https://raw.githubusercontent.com/LiHanGod/saveData/master/com.xxxxx.png)
How to Reproduce
config
parent POM.xml
cloudalibaba-consumer-nacos-order83 pom.xml