尝试反序列化DBEntity的ArangoDB,Java,Velocypack错误 [英] ArangoDB, Java, Velocypack error trying to deserialize a DBEntity
问题描述
我正在使用SpringBoot 1.5.4.RELEASE,ArangoDB Java驱动程序4.5.0,Arango Spring Data 1.1.5
I'm using SpringBoot 1.5.4.RELEASE, ArangoDB java driver 4.5.0, Arango Spring Data 1.1.5
检索对象时出现此错误.
I'm getting this error when retrieving an object.
com.arangodb.velocypack.exception.VPackParserException: java.lang.InstantiationException: com.arangodb.springframework.core.convert.DBEntity
我仍然无法找到根本原因(仍在寻找),但是我可以看到在哪里抛出了错误,在VPack类中有此方法
I can't find the root cause yet (still looking) but I can see where the error is being thrown, in the class VPack there is this method
private <T> T createInstance(final Type type) throws InstantiationException, IllegalAccessException {
final T entity;
final VPackInstanceCreator<?> creator = instanceCreators.get(type);
if (creator != null) {
entity = (T) creator.createInstance();
} else if (type instanceof ParameterizedType) {
entity = createInstance(((ParameterizedType) type).getRawType());
} else {
entity = ((Class<T>) type).newInstance();
}
return entity;
}
,但是传入的类型是接口 com.arangodb.springframework.core.convert.DBEntity
.没有创建者,它也不是参数化类型,因此调用newInstance.这当然会失败.
but the type being passed in is the interface com.arangodb.springframework.core.convert.DBEntity
. There is no creator for this, and it is not a parameterized type, so newInstance is called. This of course fails.
这似乎源自find方法中的ArangoTemplate
.这是传入DBEntity.class的地方.
This seems to originate from ArangoTemplate
in the find method. Here is where DBEntity.class is being passed in.
@Override
public <T> Optional<T> find(final String id, final Class<T> entityClass, final DocumentReadOptions options)
throws DataAccessException {
try {
final DBEntity doc = _collection(entityClass, id).getDocument(determineDocumentKeyFromId(id),
DBEntity.class, options);
return Optional.ofNullable(fromDBEntity(entityClass, doc));
} catch (final ArangoDBException e) {
throw translateExceptionIfPossible(e);
}
}
我正在尝试创建一个可以按需生成此测试的测试.如果我成功了,我会在这里发布.
I am trying to create a test that will produce this on demand. If I succeed I will post here.
谢谢,
西蒙
thanks,
Simon
推荐答案
this should normally not happen, because there exists a VPackDeseralizer for DBEntity. Do you maybe have overridden AbstractArangoConfiguration.arangoTemplate()
? In this case you have removed the needed configuration of the underlying driver.
这篇关于尝试反序列化DBEntity的ArangoDB,Java,Velocypack错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!