运行java时报错
org.springframework.beans.factory.UnsatisfiedDependencyException
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'managerItemCatServiceImpl': Unsatisfied dependency expressed through field 'itemCatServiceProxy'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemCatServiceProxy': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.service.ItemCatService. No provider available for the service com.service.ItemCatService from the url zookeeper://192.168.26.14:2181/com.alibaba.dubbo.registry.RegistryService?application=manager-web-consumer&dubbo=2.5.3&interface=com.service.ItemCatService&methods=getItemCatListByParentId&pid=9332&revision=1.0-SNAPSHOT&side=consumer×tamp=1536064507965 to the consumer 192.168.41.144 use dubbo version 2.5.3
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1268)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemCatServiceProxy': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.service.ItemCatService. No provider available for the service com.service.ItemCatService from the url zookeeper://192.168.26.14:2181/com.alibaba.dubbo.registry.RegistryService?application=manager-web-consumer&dubbo=2.5.3&interface=com.service.ItemCatService&methods=getItemCatListByParentId&pid=9332&revision=1.0-SNAPSHOT&side=consumer×tamp=1536064507965 to the consumer 192.168.41.144 use dubbo version 2.5.3
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:177)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1316)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1282)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1101)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
... 24 more
Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.service.ItemCatService. No provider available for the service com.service.ItemCatService from the url zookeeper://192.168.26.14:2181/com.alibaba.dubbo.registry.RegistryService?application=manager-web-consumer&dubbo=2.5.3&interface=com.service.ItemCatService&methods=getItemCatListByParentId&pid=9332&revision=1.0-SNAPSHOT&side=consumer×tamp=1536064507965 to the consumer 192.168.41.144 use dubbo version 2.5.3
at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:420)
at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:300)
at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:138)
at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:65)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:170)
... 34 more
我的解决:
1. maven project 污染了.m2仓库中的文件。
删除 C:\Users\Lenovo.m2\repository 里当天的文件,重新下载maven,瞬间就好了
网上的方法和可能性
(1) service接口实现类上有没有加@Service注解,注解是不是引用的spring的类?不要导错包
(2) 接口有没有写实现类,实现类是实现的对应接口么?
比如CategoryServiceImpl implementsCategoryDAO 一不小心根据自动提示,本来应该实现CategoryService,结果实现了CategoryDAO
(3) 有没有扫描Service所在的包
(4) 启动顺序问题,先启动服务提供者,再启动消费者就好了,不然找不到服务就会报这个错误
(5) 查看报错的路径ClientDao路径是否正确、配置的扫描dao包路径是否正确(我的是扫描路径错误)
(6) 查看mybatis plus配置的 扫描实体类路径是否正确
(7) 去到mybatis plus的mapper.xml 文件夹下面查看对应Dao的xml文件是否配置错误(我的是下xml配置错误,之前的xml忘了删除导致的)