问题描述:
在dubbo中,启动springboot,启动出错。出错描述为:
Initialization of bean failed; nested exception is java.lang.IllegalStateException
具体描述为:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.dubbo.spring.boot.autoconfigure.DubboAutoConfiguration': Initialization of bean failed; nested exception is java.lang.IllegalStateException: Failed to create adaptive instance: java.lang.IllegalStateException: Can't create adaptive extension interface org.apache.dubbo.common.extension.ExtensionFactory, cause: Extension instance (name: adaptive, class: interface org.apache.dubbo.common.extension.ExtensionFactory) couldn't be instantiated: Could not initialize class com.alibaba.dubbo.common.logger.LoggerFactory
看了各种类型的文章之后,有很多种解释,我都试过解决不成功。
问题分析:
最后我发现:出错的原因是在serviceImpl层中的注解有问题。
由于maven仓库中我们添加dubbo的springboot依赖为
<!--添加dubbo的springboot依赖-->
<!-- https://mvnrepository.com/artifact/org.apache.dubbo/dubbo-spring-boot-starter -->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>2.7.8</version>
</dependency>
之后我们会在serviceImpl层中通过导入dubbo的@Service注解
import org.apache.dubbo.config.annotation.Service;
//声明这是一个dubbo服务
@Service(version = "1.0.0")
我们会发现@Service被划掉。
最后我们就会报上述的错误。
解决方案:
<!--添加dubbo的springboot依赖-->
<!-- https://mvnrepository.com/artifact/org.apache.dubbo/dubbo-spring-boot-starter -->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version></