org.springframework.beans.factory.NoUniqueBeanDefinitionException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Hi, my project consists of 18 almost equialent jpa outbound channer adapter. That's an example of one of it: {code} <bean id="dataSourceSite-1" parent="baseDataSource"> <property name="jdbcUrl" value="${site.1.jdbcUrl}" /> <property name="user" value="${site.1.user}" /> <property name="password" value="${site.1.password}" /> <property name="dataSourceName" value="site1"/> <!-- initialPoolSize = minPoolSize --> <property name="initialPoolSize" value="${site.1.minPoolSize}"/> <property name="minPoolSize" value="${site.1.minPoolSize}" /> <property name="maxPoolSize" value="${site.1.maxPoolSize}" /> <property name="acquireIncrement" value="${site.1.acquireIncrement}" /> </bean> <bean id="emfSite-1" parent="baseEntityManagerFactory"> <property name="dataSource" ref="dataSourceSite-1"/> <property name="persistenceUnitName" value="emfSite-1"/> </bean> <bean id="transactionManagerSite-1" class="org.springframework.orm.jpa.JpaTransactionManager"> <constructor-arg ref="emfSite-1"/> </bean> <int-jpa:outbound-channel-adapter id="jpaOutboundChannelSite-1" persist-mode="MERGE" flush="true" entity-manager-factory="emfSite-1"> <int-jpa:request-handler-advice-chain> <ref bean="someFailureAdvice"/> <tx:advice transaction-manager="transactionManagerSite-1"> <tx:attributes> <tx:method name="*" timeout="60" rollback-for="com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException"/> </tx:attributes> </tx:advice> </int-jpa:request-handler-advice-chain> </int-jpa:outbound-channel-adapter> {code} I've updated my project to spring core 4.3.1->4.3.2 (spring integration has been still 4.3.1) and get now such exception: {code} org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.transaction.PlatformTransactionManager] is defined: expected single matching bean but found 18: transactionManagerSite-39,transactionManagerSite-18,transactionManagerSite-19,transactionManagerSite-34,transactionManagerSite-25,transactionManagerSite-36,transactionManagerSite-1,transactionManagerSite-10,transactionManagerSite-21,transactionManagerSite-32,transactionManagerSite-2,transactionManagerSite-11,transactionManagerSite-22,transactionManagerSite-33,transactionManagerSite-3,transactionManagerSite-4,transactionManagerSite-40,transactionManagerSite-8 at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:368) ~[DefaultListableBeanFactory.class:4.3.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:334) ~[DefaultListableBeanFactory.class:4.3.2.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.determineTransactionManager(TransactionAspectSupport.java:366) ~[TransactionAspectSupport.class:4.3.2.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:270) ~[TransactionAspectSupport.class:4.3.2.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[TransactionInterceptor.class:4.3.2.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [ReflectiveMethodInvocation.class:4.3.2.RELEASE] at org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice$1.execute(AbstractRequestHandlerAdvice.java:75) ~[AbstractRequestHandlerAdvice$1.class:4.3.1.RELEASE] at mypackagewebapp.spring.integration.ExportHandlerAdvice.doInvoke(ExportHandlerAdvice.java:69) ~[ExportHandlerAdvice.class:na] at org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice.invoke(AbstractRequestHandlerAdvice.java:70) [AbstractRequestHandlerAdvice.class:4.3.1.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [ReflectiveMethodInvocation.class:4.3.2.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) [JdkDynamicAopProxy.class:4.3.2.RELEASE] at com.sun.proxy.$Proxy34.handleRequestMessage(Unknown Source) [na:na] {code} As a consequence the project can't export data to Mysql. With spring-core 4.3.1 it did work. Are you aware about the problem for the next release?
    via by Franz Neumann,
    • org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.transaction.PlatformTransactionManager] is defined: expected single matching bean but found 18: transactionManagerSite-39,transactionManagerSite-18,transactionManagerSite-19,transactionManagerSite-34,transactionManagerSite-25,transactionManagerSite-36,transactionManagerSite-1,transactionManagerSite-10,transactionManagerSite-21,transactionManagerSite-32,transactionManagerSite-2,transactionManagerSite-11,transactionManagerSite-22,transactionManagerSite-33,transactionManagerSite-3,transactionManagerSite-4,transactionManagerSite-40,transactionManagerSite-8 at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:368)[DefaultListableBeanFactory.class:4.3.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:334)[DefaultListableBeanFactory.class:4.3.2.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.determineTransactionManager(TransactionAspectSupport.java:366)[TransactionAspectSupport.class:4.3.2.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:270)[TransactionAspectSupport.class:4.3.2.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)[TransactionInterceptor.class:4.3.2.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[ReflectiveMethodInvocation.class:4.3.2.RELEASE] at org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice$1.execute(AbstractRequestHandlerAdvice.java:75)[AbstractRequestHandlerAdvice$1.class:4.3.1.RELEASE] at mypackagewebapp.spring.integration.ExportHandlerAdvice.doInvoke(ExportHandlerAdvice.java:69)[ExportHandlerAdvice.class:na] at org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice.invoke(AbstractRequestHandlerAdvice.java:70)[AbstractRequestHandlerAdvice.class:4.3.1.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[ReflectiveMethodInvocation.class:4.3.2.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)[JdkDynamicAopProxy.class:4.3.2.RELEASE] at com.sun.proxy.$Proxy34.handleRequestMessage(Unknown Source)[na:na]

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    batwalrus76
    2 times, last one,
    Pilleo
    33 times, last one,
    Unknown visitor1 times, last one,
    4 more bugmates