Spring Bean ClassNotFound how to debug?

I'm new to Spring and im getting the following error

    java.lang.NoClassDefFoundError: org/springframework/beans/factory/NoUniqueBeanDefinitionException
java.lang.Class.getDeclaredMethods0(Native Method)
java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
java.lang.Class.getDeclaredMethods(Class.java:1855)
org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:159)
org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:104)
org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:87)
org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:253)
org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)
org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
javax.servlet.GenericServlet.init(GenericServlet.java:160)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2378)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:744)

From what I've searched it seems that I'm missing a library, so here is my POM

        <properties>
    <spring.version>3.2.0.RELEASE</spring.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${spring.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <scope>test</scope>
    </dependency>

    <!--Jersey-->
    <dependency>
        <groupId>org.glassfish.jersey.ext</groupId>
        <artifactId>jersey-spring3</artifactId>
        <version>2.5.1</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.jaxrs</groupId>
        <artifactId>jackson-jaxrs-json-provider</artifactId>
        <version>2.3.0</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.jaxrs</groupId>
        <artifactId>jackson-jaxrs-xml-provider</artifactId>
        <version>2.3.0</version>
    </dependency>

    <!--Security-->
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>3.2.0.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>3.2.0.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>3.2.0.RELEASE</version>
    </dependency>

    <!--Spring Data JDBC-->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.28</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.3.0.Final</version>
    </dependency>

If you guys could help me figure out which Lib it it i would be grateful. But can some one teach how to debug this kind of error? I'm using Intelij Idea 13

Here is the output of mvn dependency:three

    [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ WebGest ---
    [INFO] com.springapp:WebGest:war:1.0-SNAPSHOT
    [INFO] +- org.springframework:spring-core:jar:3.2.0.RELEASE:compile
    [INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
    [INFO] +- org.springframework:spring-web:jar:3.2.0.RELEASE:compile
    [INFO] |  +- org.springframework:spring-context:jar:3.2.0.RELEASE:compile
    [INFO] |  +- org.springframework:spring-aop:jar:3.2.0.RELEASE:compile
    [INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
    [INFO] +- org.springframework:spring-beans:jar:3.2.0.RELEASE:compile
    [INFO] +- javax.servlet:servlet-api:jar:2.5:compile
    [INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
    [INFO] +- org.springframework:spring-webmvc:jar:3.2.0.RELEASE:compile
    [INFO] |  \- org.springframework:spring-expression:jar:3.2.0.RELEASE:compile
    [INFO] +- org.springframework:spring-test:jar:3.2.0.RELEASE:test
    [INFO] +- junit:junit:jar:4.8.2:test
    [INFO] +- org.glassfish.jersey.ext:jersey-spring3:jar:2.5.1:compile
    [INFO] |  +- org.glassfish.jersey.core:jersey-server:jar:2.5.1:compile
    [INFO] |  |  +- org.glassfish.jersey.core:jersey-common:jar:2.5.1:compile
    [INFO] |  |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
    [INFO] |  |  |  \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
    [INFO] |  |  +- org.glassfish.jersey.core:jersey-client:jar:2.5.1:compile
    [INFO] |  |  +- com.google.guava:guava:jar:14.0.1:compile
    [INFO] |  |  +- org.glassfish.hk2:hk2-api:jar:2.2.0-b21:compile
    [INFO] |  |  +- org.glassfish.hk2.external:javax.inject:jar:2.2.0-b21:compile
    [INFO] |  |  +- org.glassfish.hk2:hk2-locator:jar:2.2.0-b21:compile
    [INFO] |  |  |  +- org.glassfish.hk2.external:asm-all-repackaged:jar:2.2.0-b21:compile
    [INFO] |  |  |  \- org.glassfish.hk2.external:cglib:jar:2.2.0-b21:compile
    [INFO] |  |  \- javax.validation:validation-api:jar:1.1.0.Final:compile
    [INFO] |  +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.5.1:compile
    [INFO] |  +- org.glassfish.hk2:hk2:jar:2.2.0-b21:compile
    [INFO] |  |  +- org.glassfish.hk2:hk2-utils:jar:2.2.0-b21:compile
    [INFO] |  |  |  \- javax.inject:javax.inject:jar:1:compile
    [INFO] |  |  +- org.glassfish.hk2:config-types:jar:2.2.0-b21:compile
    [INFO] |  |  +- org.glassfish.hk2:core:jar:2.2.0-b21:compile
    [INFO] |  |  +- org.glassfish.hk2:hk2-config:jar:2.2.0-b21:compile
    [INFO] |  |  |  +- org.jvnet:tiger-types:jar:1.4:compile
    [INFO] |  |  |  \- org.glassfish.hk2.external:bean-validator:jar:2.2.0-b21:compile
    [INFO] |  |  +- org.glassfish.hk2:hk2-runlevel:jar:2.2.0-b21:compile
    [INFO] |  |  \- org.glassfish.hk2:class-model:jar:2.2.0-b21:compile
    [INFO] |  +- org.glassfish.hk2:spring-bridge:jar:2.2.0-b21:compile
    [INFO] |  \- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile
    [INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.3.0:compile
    [INFO] |  +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.3.0:compile
    [INFO] |  +- com.fasterxml.jackson.core:jackson-core:jar:2.3.0:compile
    [INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.0:compile
    [INFO] |  |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
    [INFO] |  \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.3.0:compile
    [INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-xml-provider:jar:2.3.0:compile
    [INFO] |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.3.0:compile
    [INFO] |  +- org.codehaus.woodstox:stax2-api:jar:3.1.1:compile
    [INFO] |  |  \- javax.xml.stream:stax-api:jar:1.0-2:compile
    [INFO] |  \- org.codehaus.woodstox:woodstox-core-asl:jar:4.1.4:compile
    [INFO] +- org.springframework.security:spring-security-web:jar:3.2.0.RELEASE:compile
    [INFO] |  \- org.springframework.security:spring-security-core:jar:3.2.0.RELEASE:compile
    [INFO] +- org.springframework.security:spring-security-config:jar:3.2.0.RELEASE:compile
    [INFO] +- org.springframework:spring-jdbc:jar:4.0.0.RELEASE:compile
    [INFO] |  \- org.springframework:spring-tx:jar:4.0.0.RELEASE:compile
    [INFO] +- org.springframework:spring-orm:jar:4.0.0.RELEASE:compile
    [INFO] +- mysql:mysql-connector-java:jar:5.1.28:compile
    [INFO] \- org.hibernate:hibernate-core:jar:4.3.0.Final:compile
    [INFO]    +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
    [INFO]    +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
    [INFO]    +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
    [INFO]    +- dom4j:dom4j:jar:1.6.1:compile
    [INFO]    |  \- xml-apis:xml-apis:jar:1.0.b2:compile
    [INFO]    +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.4.Final:compile
    [INFO]    +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
    [INFO]    +- org.javassist:javassist:jar:3.18.1-GA:compile
    [INFO]    +- antlr:antlr:jar:2.7.7:compile
    [INFO]    \- org.jboss:jandex:jar:1.1.0.Final:compile
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.348s
    [INFO] Finished at: Mon Feb 03 21:43:43 WET 2014
    [INFO] Final Memory: 13M/217M
    [INFO] ------------------------------------------------------------------------

Answers


To troubleshoot these kind of problems, search for the class in either findjar.com or grepcode.com, in this case this is the report from grepcode for NoUniqueBeanDefinitionException.

There we can see that that class is not on version 3.2.0 of the spring-beans jar, and that the earliest version that has it 3.2.1.RELEASE.

Then check the version used in your project with mvn dependency:tree, and adapt accordingly, in this case upgrade to at least 3.2.1.RELEASE.


This class seems (from a since tag) to be introduced in Spring 3.2.1. Try to change spring.version to 3.2.1.RELEASE (to upgrade also spring-beans.jar which holds this class).


Need Your Help

mySQL: Looking for query/sql solution for daily statistic in transaction table

mysql sql

I have 'transactions' table with columns like: transactionDateTime, quantity, price, clientName, sellerName, transactionType (sell/buy)....

React state nested attributes

javascript reactjs

I'm playing around with a Fluxxor tutorial (example at the very top) and there's a simple todo list built with React. It's very basic and I wanted to add a simple validation to get better understan...