Announcement Announcement Module
Collapse
No announcement yet.
NoUniqueBeanDefinitionException problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NoUniqueBeanDefinitionException problem

    Hi everybody,
    I'm experiencing a very strange problem.
    Today I had to perform some minor changes to a library project. After performing the tasks I had to, I ran unit tests. But they fail due to:
    Code:
    java.lang.NoClassDefFoundError:org/springframework/beans/factory/NoUniqueBeanDefinitionException
    According to the docs, this exception has been introduced in version 3.2.x of the Spring framework. And that's the weird thing: the project uses version 3.1.x!
    I did not add nor remove any dependency.
    Inquiring the deps, I noticed that spring-data-jpa:1.1.0.RELEASE (used in test scope) now holds references to spring-*:3.2.1.RELEASE.
    I tried then to exclude all the 3.2.x artifact, but still I continue hitting the same exception.

    I also wanted to say that the problem came out only after a complete clean of the project (both from Eclipse and from Maven), dependencies updating and complete re-build.

    Any suggestion?

    Thanks,
    Stefano

  • #2
    I have the same problem. Were you able to solve it? if so, how? iam running a spring application with spring 3.1.X. but it throws me a

    java.lang.NoClassDefFoundError:org/springframework/beans/factory/NoUniqueBeanDefinitionException when i try to start the server.

    When i see the dependencies, i see a 3.2.1.RELEASE in the spring-orm module. I tried cleaning project, and re building it, but it doesnt work. What might be the problem. I am stuck on this issue for a week now!

    Comment


    • #3
      Hi rajeev,
      I understood the cause of that problem but didn't find a solution so far.
      The problem is about dependencies actually, and is quite weird imho.
      The artifact spring-data-jpa:1.1.0.RELEASE holds a reference to spring-*:3.2.1.RELEASE (actually, it gets the most recent version 3.* as you can see from the POM http://repo1.maven.org/maven2/org/sp....0.RELEASE.pom).
      But if you look at the POM of spring-data-jpa:1.2.0.RELEASE (http://repo1.maven.org/maven2/org/sp....0.RELEASE.pom) you'll notice that it references the spring-*:3.1.2.RELEASE. Weird.
      It really looks like that version 3.2.1 is not back-compatible with 3.1.x.
      I would suggest you to try to switch to spring-data-jpa:1.2.0.RELEASE. I am currently trying to solve other problems related to version 3.2.1.RELEASE (http://forum.springsource.org/showth...-version-3-2-1) and cannot try this solution.

      May you let me know if just this version change works for you?

      Bye,
      stefano

      Comment


      • #4
        Hi Stefano,

        Thanks for the prompt reply. I tried changing the jpa version to 1.2.0 . But it is throwing me a new error now.

        java.lang.NoClassDefFoundError: org/springframework/data/repository/config/RepositoryConfigurationExtension

        I can see that it is a problem with just the dependencies. But i cant seem to find where.

        Comment


        • #5
          Hi Stefano,

          I solved the problem As you said, the jpa1.1.0 was referring to spring latest version(3.2.x) for its orm modules.

          So, instead of changing the jpa version, i left it as it is, and in my pom.xml, i added one more dependency for spring-orm-3.1.1.RELEASE and voila!! Everything turned normal as before

          Thanks a lot for your help!!

          Comment


          • #6
            Great, I'll try your soution.

            Thanks to you,
            Stefano

            Comment


            • #7
              Originally posted by rajeev90km View Post
              Hi Stefano,

              I solved the problem As you said, the jpa1.1.0 was referring to spring latest version(3.2.x) for its orm modules.

              So, instead of changing the jpa version, i left it as it is, and in my pom.xml, i added one more dependency for spring-orm-3.1.1.RELEASE and voila!! Everything turned normal as before

              Thanks a lot for your help!!

              This resolved my issue too. Thanks.

              Comment


              • #8
                Ok, found the trick thanks to Marten Deinum that helped me out with another issue.

                I think that everything depends on this bug. It also makes sense with rajeev solution.

                Stefano

                Comment


                • #9
                  I forgot.
                  If you want to use the newest version of Spring 3, you'd better use this version in you POM
                  HTML Code:
                  [3.0.0, 3.2.1.RELEASE),(3.2.1.RELEASE,4.0.0)
                  This solved every issue for me.

                  Bye and thanks for your help,
                  Stefano

                  Comment

                  Working...
                  X