注入 bean 失败错误
来源:5-11 首页实现 - 数据层补充及API整合

Cyberpunk_2077
2021-03-31
启动zookeeper后,运行FilmApplication后,注入bean失败,FilmController截图如下:
Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2021-03-31 19:05:29.815 ERROR 15052 — [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘filmController’ defined in file [E:\IDEAProject\guns\guns-gateway\target\classes\com\stylefeng\guns\rest\modular\film\FilmController.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: filmController; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.stylefeng.guns.api.film.FilmServiceApi. No provider available for the service com.stylefeng.guns.api.film.FilmServiceApi from the url zookeeper://localhost:2181/com.alibaba.dubbo.registry.RegistryService?application=meeting-user&dubbo=2.6.0&interface=com.stylefeng.guns.api.film.FilmServiceApi&methods=getExpectRanking,getBanners,getTop,getSoonFilms,getBoxRanking,getHotFilms&pid=15052®ister.ip=192.168.1.10&side=consumer×tamp=1617188729471 to the consumer 192.168.1.10 use dubbo version 2.6.0
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:587) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) ~[spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at com.stylefeng.guns.rest.FilmApplication.main(FilmApplication.java:13) ~[classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: filmController; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.stylefeng.guns.api.film.FilmServiceApi. No provider available for the service com.stylefeng.guns.api.film.FilmServiceApi from the url zookeeper://localhost:2181/com.alibaba.dubbo.registry.RegistryService?application=meeting-user&dubbo=2.6.0&interface=com.stylefeng.guns.api.film.FilmServiceApi&methods=getExpectRanking,getBanners,getTop,getSoonFilms,getBoxRanking,getHotFilms&pid=15052®ister.ip=192.168.1.10&side=consumer×tamp=1617188729471 to the consumer 192.168.1.10 use dubbo version 2.6.0
at com.alibaba.dubbo.spring.boot.DubboConsumerAutoConfiguration$1.postProcessBeforeInitialization(DubboConsumerAutoConfiguration.java:100) ~[dubbo-spring-boot-starter-2.0.0.jar:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:422) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1694) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
… 15 common frames omitted
Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.stylefeng.guns.api.film.FilmServiceApi. No provider available for the service com.stylefeng.guns.api.film.FilmServiceApi from the url zookeeper://localhost:2181/com.alibaba.dubbo.registry.RegistryService?application=meeting-user&dubbo=2.6.0&interface=com.stylefeng.guns.api.film.FilmServiceApi&methods=getExpectRanking,getBanners,getTop,getSoonFilms,getBoxRanking,getHotFilms&pid=15052®ister.ip=192.168.1.10&side=consumer×tamp=1617188729471 to the consumer 192.168.1.10 use dubbo version 2.6.0
at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:422) ~[dubbo-2.6.0.jar:2.6.0]
at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:333) ~[dubbo-2.6.0.jar:2.6.0]
at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:163) ~[dubbo-2.6.0.jar:2.6.0]
at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:59) ~[dubbo-2.6.0.jar:2.6.0]
at com.alibaba.dubbo.spring.boot.DubboConsumerAutoConfiguration$1.postProcessBeforeInitialization(DubboConsumerAutoConfiguration.java:89) ~[dubbo-spring-boot-starter-2.0.0.jar:na]
… 18 common frames omitted
1回答
-
Cyberpunk_2077
提问者
2021-03-31
不用了,老师,问题解决了,我把gateway,api,还要film的target和iml都删了,自动生成一遍再运行,就成功了。。。估计是以前生成的这2个文件里面有哪个地方配置错了
00
相似问题