Announcement Announcement Module
Collapse
No announcement yet.
java.lang.NoSuchFieldError: NO_CREDENTIALS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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 .

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        Comment


        • #5
          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.

          Comment

          Working...
          X