Results 1 to 5 of 5

Thread: java.lang.NoSuchFieldError: NO_CREDENTIALS

  1. #1
    Join Date
    Feb 2011
    Posts
    19

    Default java.lang.NoSuchFieldError: NO_CREDENTIALS

    I'm using the latest snapshot builds:

    Code:
    <properties>
    	<spring.version>3.1.0.RELEASE</spring.version>
    	<spring.data.jpa.version>1.1.0.RC1</spring.data.jpa.version>
    	<spring.data.mongo.version>1.1.0.BUILD-SNAPSHOT</spring.data.mongo.version>
    	<query.dsl.version>2.3.0</query.dsl.version>
    </properties>
    After updating to the latest snapshot releases, I'm now unable to create any MongoDB instances - failing with the following exception:

    Code:
    Caused by: java.lang.NoSuchFieldError: NO_CREDENTIALS
    	at org.springframework.data.mongodb.core.SimpleMongoDbFactory.<init>(SimpleMongoDbFactory.java:53)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
    	... 90 more
    This appears to be some sort of version issue with the JARs, as SimpleMongoDbFactory.java:53 has no reference to NO_CREDENTIALS:


    Code:
    	public SimpleMongoDbFactory(Mongo mongo, String databaseName) {
    		Assert.notNull(mongo, "Mongo must not be null");
    		Assert.hasText(databaseName, "Database name must not be empty");
    		Assert.isTrue(databaseName.matches("[\\w-]+"),
    				"Database name must only contain letters, numbers, underscores and dashes!");
    		this.mongo = mongo;
    		this.databaseName = databaseName;
    	}
    Looking at the pom, the snapshot has been resolved to:
    spring-data-mongodb : 1.1.0.BUILD-20120402.133938-18

    Unforutnately, this is a blocker for us - so any assistance is greatly appreciated.

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

    Default

    Make sure you're using Spring Data Commons latest snapshot as well. The API has changed accordingly there. Please do not cross post issues to bot the JIRA and forums concurrently as I otherwise have to always answer questions twice .

  3. #3
    Join Date
    Feb 2011
    Posts
    19

    Default

    Thanks Oliver.

    Please do not cross post issues to bot the JIRA and forums concurrently as I otherwise have to always answer questions twice
    Understood - sorry about that.

    spring-data-commons-core is linked as 1.3.0.M1 (managed from 1.3.0.BUILD-SNAPSHOT), inheriteted from spring-data-mongodb.

    I'm not explicitly linking any version, so this should be correct.

    Please advise if there's a better version for me to be using.

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

    Default

    spring-data-mongodb 1.1.0.BUILD-SNAPSHOT refers to spring-data-commons-core 1.3.0.BUILD-SNAPSHOT. So if you get anything other than that you probably have configured that version yourself somewhere.

  5. #5
    Join Date
    Feb 2011
    Posts
    19

    Default

    Just confirming for the sake of prosperity:

    Updating to spring-data-commons-core 1.3.0.BUILD-SNAPSHOT indeed solved the problem. I ended up having to delete the downloaded snapshots to get it to update - but that's a maven issue, not a spring data issue.

Tags for this Thread

Posting Permissions

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