title: NoUniqueBeanDefinitionException even though no duplicates found
body: <p>SpringMVC application using the the latest jars. Spent quite sometime trying to figure out the issue failing which this post. Appreciate if you can respond if anyone has faced this issue</p>
  
  <p>Error stack</p>
  
  <pre><code>INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]
  INFO : org.springframework.context.annotation.ClassPathBeanDefinitionScanner - JSR-330 'javax.inject.Named' annotation found and supported for component scanning
  Feb 2, 2013 6:07:17 PM org.apache.catalina.core.ApplicationContext log
  SEVERE: StandardWrapper.Throwable
  java.lang.NoClassDefFoundError: org/springframework/beans/factory/NoUniqueBeanDefinitionException
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
      at java.lang.Class.getDeclaredMethods(Class.java:1791)
      at org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:159)
      at org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:106)
      at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:87)
      at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:233)
      at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:203)
      at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:617)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:446)
      at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
      at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
      at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
      at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
      at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
      at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
      at javax.servlet.GenericServlet.init(GenericServlet.java:160)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1274)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1186)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1081)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5320)
      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$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
  Caused by: java.lang.ClassNotFoundException: org.springframework.beans.factory.NoUniqueBeanDefinitionException
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
      ... 30 more
  Feb 2, 2013 6:07:17 PM org.apache.catalina.core.StandardContext loadOnStartup
  SEVERE: Servlet /springmvc threw load() exception
  java.lang.ClassNotFoundException: org.springframework.beans.factory.NoUniqueBeanDefinitionException
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
      at java.lang.Class.getDeclaredMethods(Class.java:1791)
      at org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:159)
      at org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:106)
      at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:87)
      at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:233)
      at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:203)
      at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:617)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:446)
      at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
      at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
      at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
      at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
      at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
      at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
      at javax.servlet.GenericServlet.init(GenericServlet.java:160)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1274)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1186)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1081)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5320)
      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$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
  </code></pre>
  
  <p>context.xml file.</p>
  
  <pre><code> &lt;?xml  version="1.0" encoding="UTF-8"?&gt;
      &lt;beans xmlns="http://www.springframework.org/schema/beans"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:aop="http://www.springframework.org/schema/aop"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:jee="http://www.springframework.org/schema/jee"
          xmlns:lang="http://www.springframework.org/schema/lang"
          xmlns:p="http://www.springframework.org/schema/p"
          xmlns:tx="http://www.springframework.org/schema/tx"
          xmlns:util="http://www.springframework.org/schema/util"
          xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
              http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
              http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
              http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
              http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
              http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"&gt;
  
          &lt;context:annotation-config /&gt;
          &lt;context:component-scan base-package="com.srisris.springmvc" /&gt;
  
          &lt;bean id="jspViewResolver"
              class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
              &lt;property name="viewClass"
                  value="org.springframework.web.servlet.view.JstlView" /&gt;
              &lt;property name="prefix" value="/WEB-INF/jsp/" /&gt;
              &lt;property name="suffix" value=".jsp" /&gt;
          &lt;/bean&gt;
  
          &lt;bean id="messageSource"
              class="org.springframework.context.support.ReloadableResourceBundleMessageSource"&gt;
              &lt;property name="basename" value="classpath:messages" /&gt;
              &lt;property name="defaultEncoding" value="UTF-8" /&gt;
          &lt;/bean&gt;
          &lt;bean id="propertyConfigurer"
              class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
              p:location="/WEB-INF/jdbc.properties" /&gt;
  
          &lt;bean id="dataSource"
              class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
              p:driverClassName="${jdbc.driverClassName}"
              p:url="${jdbc.databaseurl}" p:username="${jdbc.username}"
              p:password="${jdbc.password}" /&gt;
  
  
          &lt;bean id="sessionFactory"
              class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;
              &lt;property name="dataSource" ref="dataSource" /&gt;
              &lt;property name="configLocation"&gt;
                  &lt;value&gt;classpath:hibernate.cfg.xml&lt;/value&gt;
              &lt;/property&gt;
              &lt;property name="configurationClass"&gt;
                  &lt;value&gt;org.hibernate.cfg.AnnotationConfiguration&lt;/value&gt;
              &lt;/property&gt;
              &lt;property name="hibernateProperties"&gt;
                  &lt;props&gt;
                      &lt;prop key="hibernate.dialect"&gt;${jdbc.dialect}&lt;/prop&gt;
                      &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                  &lt;/props&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
  
          &lt;tx:annotation-driven /&gt;
  
          &lt;bean id="transactionManager"
              class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
              &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
          &lt;/bean&gt;
  
  
      &lt;/beans&gt;
  </code></pre>