Noqualifying bean of type [org.apache.solr.client.solrj.SolrServer] is defined:expected single match

严重: Exception sending context initialized event tolistener instance of classorg.springframework.web.context.ContextLoaderListener

org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'searchDao': Injection of autowired dependenciesfailed; nested exception isorg.springframework.beans.factory.BeanCreationException: Could not autowirefield: private org.apache.solr.client.solrj.SolrServercn.e3mall.search.dao.SearchDao.solrServer; nested exception isorg.springframework.beans.factory.NoUniqueBeanDefinitionException: Noqualifying bean of type [org.apache.solr.client.solrj.SolrServer] is defined:expected single matching bean but found 2: httpSolrServer,cloudSolrServer

atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)

atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)

atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)

atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)

atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)

atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)

atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)

atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)

atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)

atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)

atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)

atorg.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)

atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)

atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)

atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)

atorg.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)

atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

atorg.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)

atorg.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)

atjava.util.concurrent.FutureTask.run(FutureTask.java:266)

atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

atjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

atjava.lang.Thread.run(Thread.java:745)

Caused by:org.springframework.beans.factory.BeanCreationException: Could not autowirefield: private org.apache.solr.client.solrj.SolrServercn.e3mall.search.dao.SearchDao.solrServer; nested exception isorg.springframework.beans.factory.NoUniqueBeanDefinitionException: Noqualifying bean of type [org.apache.solr.client.solrj.SolrServer] is defined:expected single matching bean but found 2: httpSolrServer,cloudSolrServer

atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)

atorg.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)

atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)

...22 more

Caused by:org.springframework.beans.factory.NoUniqueBeanDefinitionException: Noqualifying bean of type [org.apache.solr.client.solrj.SolrServer] is defined:expected single matching bean but found 2: httpSolrServer,cloudSolrServer

atorg.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1126)

atorg.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)

atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)

...24 more


解决方案:

   solr配置文件中写了两个bean注入单机版和集群版,注释掉一个就可以了

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值