my project is using Spring data mongodb. I was not having below error until i made an edit to one of the document that has a field with Array of Documents in it. It was working fine before but now I keep getting the below error.
The field i updated was impapps in the Projects POJO class. I am not sure how to clear this error tried different things but did not work out.
SEVERE: Servlet.service() for servlet [appServlet] in context with path [/mongodproject] threw exception [Request processing failed; nested exception is org.springframework.data.mapping.model.MappingInstantiationException: Could not instantiate bean class [java.util.List]: Specified class is an interface] with root cause
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [java.util.List]: Specified class is an interface
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:101)
at org.springframework.data.convert.ReflectionEntityInstantiator.createInstance(ReflectionEntityInstantiator.java:60)
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:232)
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:212)
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.readValue(MappingMongoConverter.java:1008)
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.access$100(MappingMongoConverter.java:75)
at org.springframework.data.mongodb.core.convert.MappingMongoConverter$MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:957)
at org.springframework.data.mongodb.core.convert.MappingMongoConverter.getValueInternal(MappingMongoConverter.java:713)
Here are my POJO and Spring Repository class.
Project POJO Class
@Document(collection="releases")
public class Project {
@Id
private String id;
......
@Field("impapps")
private List<ImpactedApplications> impapps=new ArrayList<ImpactedApplications>();
.....getters/setters
}
ImpactedApplication POJO Class:
public class ImpactedApplications {
@Field("appid")
private String appId;
.....
@Field("repository")
private List<ScriptsRepo> rep=new ArrayList<ScriptsRepo>();
@Field("artifacts")
private List<Artifacts> artifacts=new ArrayList<Artifacts>();
//getter and setters
}
Artifacts POJO Class
public class Artifacts {
@Field("artifacttype")
private String artifactType;
@Field("documentlink")
private String documentLink;
@Field("arttestphase")
private String artTestPhase;
@Field("artifactname")
private ArtifactsEnums artifactsNames;
@Field("startdate")
private String startDate;
@Field("enddate")
private String endDate;
@Field("peerrev")
private boolean peerReview;
@Field("busrev")
private boolean busReview;
@Field("na")
private boolean na;
Spring Repository classes
public interface ProjectRepository extends Repository<Project, String> {
Project findById(String id);
List<Project> findByYearAndReleaseMonthNoOrderByProjectNameDesc(String year,String month, Sort sort);
Project findByYearAndReleaseMonthNoAndId(String year, String month,String id);
Whenever i call the above methods i keep getting the exception.
Below is how my document is looking currently.

impapps,repositoryandartifactsare arrays in MongoDB? If so, theread(…)method should run into thetypeToUse.isCollectionLike() && dbo instanceof BasicDBListclause and properly create a collection for the property. I am assuming you rather find something not an array and thus the entity resolution kicks in. PS: Would you mind properly formatting the code samples? Makes the post much better to read and will probably attract more people to answer.documentpic attached.impappais created as an array,artifactsis created as array andrepositoryis currently created as blank array currently.impappsis storing as an document instead of an array of documents..I think there is issues in my code. When i edit theimpappslooks like it is not storing as an array but as a document.Criteria crit=new Criteria().andOperator( Criteria.where("_id").is(projectId), Criteria.where("impapps.appid").is(impapp.getAppId()) );Query query=new Query(crit);Update upd=new Update(); upd.set("impapps", impapp);mongoTemplate.updateFirst(query, upd, Project.class)