Uploaded image for project: 'Spring Data MongoDB'
  1. Spring Data MongoDB
  2. DATAMONGO-716

setMongoOperations in MongoRepositoryFactoryBean calls for invalid method setMappingContext

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: None
    • Component/s: Core, Repository
    • Labels:
      None
    • Environment:
      Any Environment

      Description

      When I run Spring Data MongoDB 1.2.1, I found the code throwing following exception stack:

      Caused by: org.springframework.beans.PropertyBatchUpdateException: Failed properties: Property 'mongoOperations' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.data.mongodb.repository.support.MongoRepositoryFactoryBean.setMappingContext(Lorg/springframework/data/mapping/context/MappingContext;)V

      Detail stack trace is attached.

      After analyzing the code: org.springframework.data.mongodb.repository.support.MongoRepositoryFactoryBean, setMongoOperations(…) references to setMappingContext(…) which does not exist in the same class or super class which is causing the problem.

      This has stopped me to work further in the project. Please fix it asap. This is a code review bug.

      1. ExceptionTrace_MongoRepo.log
        13 kB
        Triguna Mutuguppe Sripathi

        Activity

        Hide
        olivergierke Oliver Gierke added a comment -

        As the pom.xml of Spring Data MongoDB suggests, it requires a Spring Data Commons of the 1.5.x generation. Please make sure you have e.g. SD Commons 1.5.1 in your classpath.

        Show
        olivergierke Oliver Gierke added a comment - As the pom.xml of Spring Data MongoDB suggests, it requires a Spring Data Commons of the 1.5.x generation. Please make sure you have e.g. SD Commons 1.5.1 in your classpath.
        Hide
        trigunam Triguna Mutuguppe Sripathi added a comment -

        Wow... I had a spring-data-jpa from the previous project which caused the problem.
        Like you mentioned, I had two jars which was referencing SD Commons one of them was 1.4.0.jar (SD Commons Core) and both the jar files were available in the classpath.

        This issue is resolved as soon as I removed spring-data-jpa. Thanks.

        PS: This issue was never mentioned in any of the forums or jira, so I had to raise the issue apologies...

        Thanks for your help Oliver. It was real quick and thoughtful.
        Triguna

        Show
        trigunam Triguna Mutuguppe Sripathi added a comment - Wow... I had a spring-data-jpa from the previous project which caused the problem. Like you mentioned, I had two jars which was referencing SD Commons one of them was 1.4.0.jar (SD Commons Core) and both the jar files were available in the classpath. This issue is resolved as soon as I removed spring-data-jpa. Thanks. PS: This issue was never mentioned in any of the forums or jira, so I had to raise the issue apologies... Thanks for your help Oliver. It was real quick and thoughtful. Triguna
        Hide
        olivergierke Oliver Gierke added a comment -

        We've moved to the notion of a release train since two major releases. Currently the roadmap is maintained in the Spring Data Commons' wiki. You find a list of compatible versions here (in case you still need to work with both the Mongo and the JPA module). I'll go ahead and add the necessary info to the project's websites.

        Show
        olivergierke Oliver Gierke added a comment - We've moved to the notion of a release train since two major releases. Currently the roadmap is maintained in the Spring Data Commons' wiki . You find a list of compatible versions here (in case you still need to work with both the Mongo and the JPA module). I'll go ahead and add the necessary info to the project's websites.
        Hide
        trigunam Triguna Mutuguppe Sripathi added a comment - - edited

        Oliver Gierke, yes that would be great. We might plan to work both of them together... However just a question, if I exclude sd-commons-core jar file from pom.xml for JPA will my JPA-Hibernate-Jdbc code work? (I doubt)

        Show
        trigunam Triguna Mutuguppe Sripathi added a comment - - edited Oliver Gierke, yes that would be great. We might plan to work both of them together... However just a question, if I exclude sd-commons-core jar file from pom.xml for JPA will my JPA-Hibernate-Jdbc code work? (I doubt)
        Hide
        olivergierke Oliver Gierke added a comment -

        You shouldn't need to exclude anything. Simply include the matching versions stated in the document I linked.

        Show
        olivergierke Oliver Gierke added a comment - You shouldn't need to exclude anything. Simply include the matching versions stated in the document I linked.
        Hide
        trigunam Triguna Mutuguppe Sripathi added a comment - - edited

        What I mean is, spring-data-jpa needs spring-data-commons-core for which the latest version is 1.4.1.RELEASE and spring-data-mongo needs spring-data-commons for which the latest version is 1.5.1.RELEASE.

        That is the reason I mentioned the spring-data-jpa one to exclude spring-data-commons-core (when we plan to use both jpa and mongo) and will it uses whatever classes available in the classpath? (I mean is the packages in both jar files same?)

        if we plan to use both jpa-hibernate and jpa-mongo, what would be the ideal scenario in the above case I have mentioned in this comment?

        Show
        trigunam Triguna Mutuguppe Sripathi added a comment - - edited What I mean is, spring-data-jpa needs spring-data-commons-core for which the latest version is 1.4.1.RELEASE and spring-data-mongo needs spring-data-commons for which the latest version is 1.5.1.RELEASE. That is the reason I mentioned the spring-data-jpa one to exclude spring-data-commons-core (when we plan to use both jpa and mongo) and will it uses whatever classes available in the classpath? (I mean is the packages in both jar files same?) if we plan to use both jpa-hibernate and jpa-mongo, what would be the ideal scenario in the above case I have mentioned in this comment?
        Hide
        olivergierke Oliver Gierke added a comment -

        No, please read the links carefully. If you want to use SD MongoDB in 1.2.1 you're in the Arora release train. According to the web page I linked, the release train includes SD JPA 1.3.2 and SD Commons in 1.5.1. If you use these versions, they will work together smoothly.

        Show
        olivergierke Oliver Gierke added a comment - No, please read the links carefully. If you want to use SD MongoDB in 1.2.1 you're in the Arora release train. According to the web page I linked, the release train includes SD JPA 1.3.2 and SD Commons in 1.5.1. If you use these versions, they will work together smoothly.
        Hide
        olivergierke Oliver Gierke added a comment -

        Going forward, for general questions, please use the forums.

        Show
        olivergierke Oliver Gierke added a comment - Going forward, for general questions, please use the forums.
        Hide
        trigunam Triguna Mutuguppe Sripathi added a comment - - edited

        Thanks for your help on this one.

        Show
        trigunam Triguna Mutuguppe Sripathi added a comment - - edited Thanks for your help on this one.

          People

          • Assignee:
            olivergierke Oliver Gierke
            Reporter:
            trigunam Triguna Mutuguppe Sripathi
            Last updater:
            Trevor Marshall
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: