出现 “Could not autowire field” 错误

启动服务的时候就报Error creating bean with name ‘searchDao’: Injection of autowired dependencies failed;

访问的时候就显示一大堆的错误信息。重新打开了redis,solr。检查了所有的代码及配置文件。ps:也以为是注解大小写写错,或者忘记写注解。后来发现都不是!!!折磨了一整天,都快窒息了! 第一次写这个,想把这个记录下来~~

问题如下:

[org.springframework.web.context.support.XmlWebApplicationContext]-[WARN] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘contentCategoryController’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private content.service.ContentCategoryService controller.ContentCategoryController.contentCategoryController; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘contentCategoryService’: FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service content.service.ContentCategoryService. No provider available for the service content.service.ContentCategoryService from the url zookeeper://192.168.25.128:2181/com.alibaba.dubbo.registry.RegistryService?application=taotao-manager-web&dubbo=2.5.3&interface=content.service.ContentCategoryService&methods=createContentCategory,getContentCategoryList&pid=8408&revision=0.0.1-SNAPSHOT&side=consumer&timeout=300000&timestamp=1571885185117 to the consumer 192.168.25.1 use dubbo version 2.5.3
2019-10-24 10:46:34,331 [localhost-startStop-1] [org.springframework.web.servlet.DispatcherServlet]-[ERROR] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘contentCategoryController’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private content.service.ContentCategoryService controller.ContentCategoryController.contentCategoryController; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘contentCategoryService’: FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service content.service.ContentCategoryService. No provider available for the service content.service.ContentCategoryService from the url zookeeper://192.168.25.128:2181/com.alibaba.dubbo.registry.RegistryService?application=taotao-manager-web&dubbo=2.5.3&interface=content.service.ContentCategoryService&methods=createContentCategory,getContentCategoryList&pid=8408&revision=0.0.1-SNAPSHOT&side=consumer&timeout=300000&timestamp=1571885185117 to the consumer 192.168.25.1 use dubbo version 2.5.3
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private content.service.ContentCategoryService controller.ContentCategoryController.contentCategoryController; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘contentCategoryService’: FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service content.service.ContentCategoryService. No provider available for the service content.service.ContentCategoryService from the url zookeeper://192.168.25.128:2181/com.alibaba.dubbo.registry.RegistryService?application=taotao-manager-web&dubbo=2.5.3&interface=content.service.ContentCategoryService&methods=createContentCategory,getContentCategoryList&pid=8408&revision=0.0.1-SNAPSHOT&side=consumer&timeout=300000&timestamp=1571885185117 to the consumer 192.168.25.1 use dubbo version 2.5.3
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessorKaTeX parse error: Expected 'EOF', got '&' at position 852: …tao-manager-web&̲dubbo=2.5.3&int…AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
… 31 more
Caused by: java.lang.IllegalStateException: Failed to check the status of the service content.service.ContentCategoryService. No provider available for the service content.service.ContentCategoryService from the url zookeeper://192.168.25.128:2181/com.alibaba.dubbo.registry.RegistryService?application=taotao-manager-web&dubbo=2.5.3&interface=content.service.ContentCategoryService&methods=createContentCategory,getContentCategoryList&pid=8408&revision=0.0.1-SNAPSHOT&side=consumer&timeout=300000&timestamp=1571885185117 to the consumer 192.168.25.1 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)
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
… 39 more

最后在solr的配置文件下发现了问题!…其实之前已经看了很多次了,但是都没发现(可能心态有点崩了) ··还是要细心啊。

在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值