java.lang.IllegalArgumentException: Could not instantiate Collection type: java.util.EnumSet

Spring JIRA | Milan Skuhra | 3 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Using EnumSet as collection for enums caused exception when BasicDBList from database is mapped back to EnumSet. Stack trace when version org.springframework.data:spring-data-mongodb:1.3.3.RELEASE is used: {code} java.lang.IllegalArgumentException: Could not instantiate Collection type: java.util.EnumSet at org.springframework.core.CollectionFactory.createCollection(CollectionFactory.java:258) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readCollectionOrArray(MappingMongoConverter.java:778) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readValue(MappingMongoConverter.java:1048) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.access$100(MappingMongoConverter.java:77) at org.springframework.data.mongodb.core.convert.MappingMongoConverter$MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:999) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.getValueInternal(MappingMongoConverter.java:755) at org.springframework.data.mongodb.core.convert.MappingMongoConverter$1.doWithPersistentProperty(MappingMongoConverter.java:256) at org.springframework.data.mongodb.core.convert.MappingMongoConverter$1.doWithPersistentProperty(MappingMongoConverter.java:249) at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:257) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:249) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:223) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:187) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:183) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:77) at org.springframework.data.mongodb.core.MongoTemplate$ReadDbObjectCallback.doWith(MongoTemplate.java:1975) at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1671) at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1496) at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1480) at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:527) at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:518) ... Caused by: java.lang.InstantiationException: java.util.EnumSet at java.lang.Class.newInstance0(Class.java:342) at java.lang.Class.newInstance(Class.java:310) at org.springframework.core.CollectionFactory.createCollection(CollectionFactory.java:255) ... {code}

    Spring JIRA | 3 years ago | Milan Skuhra
    java.lang.IllegalArgumentException: Could not instantiate Collection type: java.util.EnumSet
  2. 0

    Using EnumSet as collection for enums caused exception when BasicDBList from database is mapped back to EnumSet. Stack trace when version org.springframework.data:spring-data-mongodb:1.3.3.RELEASE is used: {code} java.lang.IllegalArgumentException: Could not instantiate Collection type: java.util.EnumSet at org.springframework.core.CollectionFactory.createCollection(CollectionFactory.java:258) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readCollectionOrArray(MappingMongoConverter.java:778) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readValue(MappingMongoConverter.java:1048) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.access$100(MappingMongoConverter.java:77) at org.springframework.data.mongodb.core.convert.MappingMongoConverter$MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:999) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.getValueInternal(MappingMongoConverter.java:755) at org.springframework.data.mongodb.core.convert.MappingMongoConverter$1.doWithPersistentProperty(MappingMongoConverter.java:256) at org.springframework.data.mongodb.core.convert.MappingMongoConverter$1.doWithPersistentProperty(MappingMongoConverter.java:249) at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:257) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:249) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:223) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:187) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:183) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:77) at org.springframework.data.mongodb.core.MongoTemplate$ReadDbObjectCallback.doWith(MongoTemplate.java:1975) at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1671) at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1496) at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1480) at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:527) at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:518) ... Caused by: java.lang.InstantiationException: java.util.EnumSet at java.lang.Class.newInstance0(Class.java:342) at java.lang.Class.newInstance(Class.java:310) at org.springframework.core.CollectionFactory.createCollection(CollectionFactory.java:255) ... {code}

    Spring JIRA | 3 years ago | Milan Skuhra
    java.lang.IllegalArgumentException: Could not instantiate Collection type: java.util.EnumSet

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Could not instantiate Collection type: java.util.EnumSet

      at org.springframework.core.CollectionFactory.createCollection()
    2. Spring Core
      CollectionFactory.createCollection
      1. org.springframework.core.CollectionFactory.createCollection(CollectionFactory.java:258)
      1 frame
    3. Spring Data MongoDB - Core
      MappingMongoConverter$1.doWithPersistentProperty
      1. org.springframework.data.mongodb.core.convert.MappingMongoConverter.readCollectionOrArray(MappingMongoConverter.java:778)
      2. org.springframework.data.mongodb.core.convert.MappingMongoConverter.readValue(MappingMongoConverter.java:1048)
      3. org.springframework.data.mongodb.core.convert.MappingMongoConverter.access$100(MappingMongoConverter.java:77)
      4. org.springframework.data.mongodb.core.convert.MappingMongoConverter$MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:999)
      5. org.springframework.data.mongodb.core.convert.MappingMongoConverter.getValueInternal(MappingMongoConverter.java:755)
      6. org.springframework.data.mongodb.core.convert.MappingMongoConverter$1.doWithPersistentProperty(MappingMongoConverter.java:256)
      7. org.springframework.data.mongodb.core.convert.MappingMongoConverter$1.doWithPersistentProperty(MappingMongoConverter.java:249)
      7 frames
    4. Spring Data Core
      BasicPersistentEntity.doWithProperties
      1. org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:257)
      1 frame
    5. Spring Data MongoDB - Core
      MongoTemplate.find
      1. org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:249)
      2. org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:223)
      3. org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:187)
      4. org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:183)
      5. org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:77)
      6. org.springframework.data.mongodb.core.MongoTemplate$ReadDbObjectCallback.doWith(MongoTemplate.java:1975)
      7. org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1671)
      8. org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1496)
      9. org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1480)
      10. org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:527)
      11. org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:518)
      11 frames