Results 1 to 8 of 8

Thread: [mongodb] MongoRepositoryFactory.getTargetRepository (dependency issue?)

  1. #1
    Join Date
    May 2012
    Posts
    3

    Default [mongodb] MongoRepositoryFactory.getTargetRepository (dependency issue?)

    Hi *,

    i was just upgrading from my cozy RELEASE-dependency to 1.1.0-BUILD-SNAPSHOT [1.1.0.BUILD-20120502.180038-28], because of an added feature (https://jira.springsource.org/browse/DATAMONGO-347).

    I have added it to my dependency tree, including the automatically injected child dependencies (netbeans magic...), in particular spring-data-commons-core-1.3.0-BUILD-SNAPSHOT [1.3.0.BUILD-20120502.083219-130].

    Code:
            <dependency>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-mongodb</artifactId>
                <version>1.1.0.BUILD-SNAPSHOT</version> 
            </dependency>
    When trying to run my app, i get the following error:

    Code:
    Caused by: java.lang.NoSuchMethodError: org.springframework.data.repository.core.RepositoryMetadata.getDomainType()Ljava/lang/Class;
    	at org.springframework.data.mongodb.repository.support.MongoRepositoryFactory.getTargetRepository(MongoRepositoryFactory.java:84)
    	at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:131)
    	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:114)
    	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:38)
    	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
    The above mentioned spring-data-commons-core-1.3.0-BUILD-SNAPSHOT contains the class org.springframework.data.repository.core.Repositor yMetadata, but the desired method getDomainType is missing.

    Code:
    package org.springframework.data.repository.core;
    
    import java.lang.reflect.Method;
    
    public interface RepositoryMetadata {
    
        public Class<?> getIdClass();
    
        public Class<?> getDomainClass();
    
        public Class<?> getRepositoryInterface();
    
        public Class<?> getReturnedDomainClass(Method method);
    }
    what the heck?

    Thanks for pointings in advance!

  2. #2
    Join Date
    Apr 2007
    Posts
    276

    Default Revert to a stable version

    Try this instead:

    Code:
    <dependency>
    	<groupId>org.springframework.data</groupId>
    	<artifactId>spring-data-jpa</artifactId>
    	<version>1.0.3.RELEASE</version>
    </dependency>
    I had the same issue and this fixed it. Must be an issue with the snapshot.

  3. #3
    Join Date
    May 2012
    Posts
    3

    Default

    Thanks for your post!

    On the Spring Data overview page it says that the JPA-Module is in the category of relational databases. How does that fit to mongodb?

    On the other hand, the JPA 1.0.3.RELEASE comes with an older version of the above pasted class which is also missing the required function...

    Code:
    package org.springframework.data.repository.core;
    
    public interface RepositoryMetadata {
    
        public Class<?> getIdClass();
    
        public Class<?> getDomainClass();
    
        public Class<?> getRepositoryInterface();
    }
    I really need this Spring Data MongoDB 1.1.0 feature

    Strange is, that the last build was successfully testet https://build.springsource.org/brows...-DATAMONGO-136... Is there a way to find out against which Spring Data Commons Core version/snapshot it was built?

    Thanks in advance!

  4. #4
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    483

    Default

    The advice to go with SD JPA was clearly nonsense. It's stated in the pom.xml: Current SD MongoDB builds are running against SD Commons 1.3.0.BUILD-SNAPSHOTS. So if you're only using SD MongoDB in your project, simply declare the SD MongoDB dependency *only*. This will pull in the correct version of SD Commons.

  5. #5
    Join Date
    May 2012
    Posts
    3

    Default

    Thanks Oliver!

    In my pom.xml, i only have the following xml regarding Spring Data:

    Code:
            <dependency>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-mongodb</artifactId>
                <version>1.1.0.BUILD-SNAPSHOT</version> 
            </dependency>
    Netbeans automagically fetches the dependency spring-data-commons-core-1.3.0-BUILD-SNAPSHOT, specifically 1.3.0.BUILD-20120502.083219-130. This looks as if it was from today.

    But when i inspect the RepositoryMetadata class of the fetched SD Core Snapshot, the getDomainType-method is missing, exactly what the error compains about

    Code:
    package org.springframework.data.repository.core;
    
    import java.lang.reflect.Method;
    
    public interface RepositoryMetadata {
    
        public Class<?> getIdClass();
    
        public Class<?> getDomainClass();
    
        public Class<?> getRepositoryInterface();
    
        public Class<?> getReturnedDomainClass(Method method);
    }
    Is there a more recent SD Commons Core Snapshot or is something wrong with this one? Am I missing something... totally lost..

  6. #6
    Join Date
    Jun 2006
    Posts
    5

    Default

    Hi philopl ,
    I am also stuck in there , I have not found any solution yet. It was working fine until last week but failing now for the reason that you have mentioned.

    Any one could help , please?

    Thanks

  7. #7
    Join Date
    Jun 2006
    Posts
    5

    Default

    Hi ,
    again here,
    It seems that I got it working by switching back SD jpa1.1.0.M1 from 1.1.9RC1. This has also swapped the SD common to 1.2.0.M1 from 1.3.
    I spend 12 hours on it and found it just after replying on this thread.

    Try changing the SD Jpa versions, it will be fixed. Fingers crossed.
    sumncc

  8. #8
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    483

    Default

    Which Maven repository are you using? Be sure to use our http://repo.springsource.org/libs-snapshot one as indicated on the project page. We had accidental deployments to the old S3 repository which caused hickups in the dependency resolution.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •