No qualifying bean of type ‘com.alibaba.dubbo.config.ApplicationConfig‘ available: expected at least
目录
前言
异常信息,应用启动异常截图
主要得报错信息
猜测原因
其他解决办法:
详细的报错日志信息
前言
主要是启动异常,开发完一个业务需求之后发现,居然有一个bean启动异常,提示的信息真的让人摸到头脑,这个到底是什么原因导致的这个异常错误,不可思议!
异常信息,应用启动异常截图
目前我启动的应用在测试环境的报错信息如下。很少见,启动的时候提示的。
主要得报错信息
No qualifying bean of type 'com.alibaba.dubbo.config.ApplicationConfig' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations:
明显提示的是config的配置已经实例化了,导致注入失败,而不能继续加载后面的配置项!
猜测原因
实例化类是,zk部署在一台服务器,Service调用重名但是却部署到了俩台服务器导致同一个API,俩台服务器依赖调用,同时是服务名相同,但是项目名称不一样导致!
改动,实例化类的名称进行修改掉,比如此处的:【name 'dupNewsController'】暂时性的还是后续报错!
应该是缓存没有清空!
解决办法步骤
1、清除zk里面的data目录,里面文件很大,然后重启原来zk依赖的应用的服务;
2、确定应用起来的仅有一台服务占用一个端口,发现有俩个应用启动导致依赖错乱;
3、注释掉提示报错的bean,然后重新mvn -clean install,重新运行;
然后解决!不在有类似的提示。
其他解决办法:
启动的时候注入实例化,手动的进行配置,避免二次注入的时候因为bean重复名称注入失败!
这个方法我另外一个同事是这么解决的,我的不是。然后放在这里作为一个备注,如果可以叠话,你们可以尝试一下。重要的代码如下
import com.alibaba.dubbo.config.ApplicationConfig;
import com.datadevelopment.middle.auth.common.ShiroConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@Slf4j
@SpringBootApplication(scanBasePackages = {ShiroConstant.AUTH_PACKAGE, "com.datadevelopment.npp"})
public class NppWebApplication {public static void main(String[] args) {try {// 应用配置信息ApplicationConfig application = new ApplicationConfig("news-production-platform-web");// 版本号application.setVersion("2021.10.27.1");// 负责人application.setOwner("loveyouforever");// 组织名称application.setOrganization("test_organization");// 环境application.setEnvironment("test");// 字节码编译器application.setCompiler("javassist");SpringApplication.run(NppWebApplication.class, args);log.info("the service npp-web started!");log.error("正常启动完成");} catch (Exception e) {log.error("the service npp-web start failed, the exception: {}", e);}}}
还有把应用名称在项目中进行配置 YML
application:name: news-production-platform-web
spring:profiles:include: daoredis:database: 0host: 127.0.0.1port: 6379timeout: 3000jedis:pool:max-active: -1max-wait: -1max-idle: 8min-idle: 3application:name: news-production-platform-web
dubbo:application:name: news-production-platform-web
redis:address: redis://127.0.0.1:6379
app:name: npp-webgroup: tbm-devregistry:address: 127.0.0.1:2181
rpc:protocol:name: dubbomonitor:enable: truetrace:log: false
management:endpoints:web:exposure:include: "*"base-path: /endpoint:health:show-details: alwayshttptrace: trueshutdown:enabled: trueserver:port: 8081
server:port: 9002servlet:context-path: /npplogback:fileDir: /home/program/npp/npp-web/log/dailylevel: ERROR
logging:config: classpath:logback-spring.xml
然后maven-install上传到xshell之后运行目前是正常的:
启动命令:
nohup java -Xms512m -Xmx512m -Xrunjdwp:transport=dt_socket,address=9013,server=y,suspend=n -jar /home/program/npp/npp-web/npp*.jar > /home/program/npp/npp-web/log/npp.log 2>&1 &
详细的报错日志信息
021-10-27 16:22:13.251|ERROR|main|826|o.s.boot.SpringApplication :Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dupNewsController' defined in URL [jar:file:/home/program/npp/npp-web/npp-web-1.0.0-SNAPSHOT.jar!/BOOT-INF/classes!/com/*/datadevelopment/npp/web/controller/news/DupNewsController.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanInitializationException: Failed to init remote service reference at filed tbmDupNewsFacade in class com.*.datadevelopment.npp.web.controller.news.DupNewsController; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'consumerConfig' defined in class path resource [com/*/jrescloud/rpc/def/RpcAutoConfiguration.class]: Unsatisfied dependency expressed through method 'consumerConfig' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.alibaba.dubbo.config.ApplicationConfig' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
at com.*.datadevelopment.npp.NppWebApplication.main(NppWebApplication.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: org.springframework.beans.factory.BeanInitializationException: Failed to init remote service reference at filed tbmDupNewsFacade in class com.*.datadevelopment.npp.web.controller.news.DupNewsController; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'consumerConfig' defined in class path resource [com/*/jrescloud/rpc/def/RpcAutoConfiguration.class]: Unsatisfied dependency expressed through method 'consumerConfig' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.alibaba.dubbo.config.ApplicationConfig' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at com.alibaba.dubbo.config.spring.AnnotationBean.postProcessBeforeInitialization(AnnotationBean.java:392)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:415)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
... 23 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'consumerConfig' defined in class path resource [com/*/jrescloud/rpc/def/RpcAutoConfiguration.class]: Unsatisfied dependency expressed through method 'consumerConfig' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.alibaba.dubbo.config.ApplicationConfig' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
No qualifying bean of type ‘com.alibaba.dubbo.config.ApplicationConfig‘ available: expected at least相关推荐
- No qualifying bean of type ‘com.xxx.xx.service.xxService‘ available: expected at leas
No qualifying bean of type 'com.xxxx.xx.service.xxService' available: expected at least 1 bean which ...
- No qualifying bean of type 'com.xxx.xx.service.xxService' available: expected at leas
No qualifying bean of type 'com.xxxx.xx.service.xxService' available: expected at least 1 bean which ...
- No qualifying bean of type ‘com.alibaba.buc.acl.api.service.MenuReadService‘ available
resource dependencies failed 接入阿里云acl时,报MenuReadService的bean无效.找了MenuReadService接口对应的实现类,没有找到,修改了各种m ...
- No qualifying bean of type [XXX.XXX.XXX] found for dependency: expected at least 1 bean which q
老生常谈的问题,没写spring bean的注解(@service,@Repository..),所以无法完成自动装配.如果注解不行就在xml里面试试.
- No qualifying bean of type ‘com.nanjing.cms.mapper.CrmBannerMapper‘ available: expected at least 1 b
原因: Spring boot Application没有扫描到mapper 由于当初是cmsservice
- mapper注入失败,NoSuchBeanDefinitionException: No qualifying bean of type [com.xxx.XxxMapper] found for d
mapper注入失败: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifyin ...
- SpringBoot中出现 No qualifying bean of type ‘com.tanhua.server.mapper.UserInfoMapper‘ available: expect
在使用SpringBoot框架时出现 No qualifying bean of type 'com.tanhua.server.mapper.UserInfoMapper' available: e ...
- 解决org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 异常
在spring中出现: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of ...
- 解决org.springframework.beans.factory.NoUniqueBeanDefinitionException No qualifying bean of type
在spring中出现: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of ...
最新文章
- Python 10 MySQL数据库(一)
- Python 类的属性与实例属性
- python中的文件父路径怎么表达_如何在Python中访问父目录
- matlab画微分方程的矢量场图_MATLAB偏微分方程
- linux与shell编程指南,LINUX与UNIX SHELL编程指南
- 光动能表怎么维护_西铁城手表推荐,西铁城光动能表推荐选购指南
- jzoj5223-B【矩阵乘法】
- NOIP2013货车运输
- 服务器克隆机网络端口排错
- PAT 乙级 1002. 写出这个数 (20) Java版
- ASP.NET MVC 4 中Jquery上传插件Uploadify简单使用-版本:3.2.1
- php后端技术 有哪些,web后端开发技术有哪些 ?
- PHPExcel浏览器输出Excel2007出错
- java date计算年龄_Java中使用LocalDate根据日期来计算年龄
- win8计算机可用内存不足,Win8.1频繁提示内存不足是怎么回事
- 2021 第五届“达观杯” 基于大规模预训练模型的风险事件标签识别】3 Bert和Nezha方案
- 多设备monkey测试工具_基于Tkinter GUI操作
- Windows电脑开机蓝屏(2)
- 所以Web 3.0到底是什么?
- 图像处理--特征匹配
热门文章
- Java毕设springboot图片分享网站平台 毕业设计源码 使用教程(3
- 王菊与周星驰画风迥异跨次元合作
- 小程序制作:C# - Windows窗体应用制作加法计算器
- 网络共享计算机登录失败,win7添加共享打印机登陆失败怎么办
- 实际项目的数据库设计基本方法
- 买iPhone 12省钱攻略,你可以这么操作!
- 华为eNSP综合实验
- linux 光驱如何自动运行,怎样才能让光盘放入光驱后自动运行某个程序?
- mac版 seoclient_Scrutiny 9 for Mac(网站SEO优化工具)
- 如何打造“百万美金直播间”?教你几招跨境直播秘诀。