ArangoDB,Java,尝试反序列化 DBEntity 时出现 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
我在检索对象时遇到此错误。
com.arangodb.velocypack.exception.VPackParserException: java.lang.InstantiationException: com.arangodb.springframework.core.convert.DBEntity
我还找不到根本原因(仍在寻找),但我可以看到错误发生的地方,在 class VPack 中有这个方法
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。这当然失败了。
这似乎源于find方法中的ArangoTemplate
。这是 DBEntity.class 被传入的地方。
@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);
}
}
我正在尝试创建一个可以按需生成的测试。如果我成功了,我会post这里。
谢谢,
西蒙
这通常不会发生,因为存在 VPackDeseralizer for DBEntity。您是否已覆盖 AbstractArangoConfiguration.arangoTemplate()
?在这种情况下,您已经删除了底层驱动程序所需的配置。
我正在使用 SpringBoot 1.5.4.RELEASE,ArangoDB java 驱动程序 4.5.0,Arango Spring Data 1.1.5
我在检索对象时遇到此错误。
com.arangodb.velocypack.exception.VPackParserException: java.lang.InstantiationException: com.arangodb.springframework.core.convert.DBEntity
我还找不到根本原因(仍在寻找),但我可以看到错误发生的地方,在 class VPack 中有这个方法
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。这当然失败了。
这似乎源于find方法中的ArangoTemplate
。这是 DBEntity.class 被传入的地方。
@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);
}
}
我正在尝试创建一个可以按需生成的测试。如果我成功了,我会post这里。
谢谢,
西蒙
这通常不会发生,因为存在 VPackDeseralizer for DBEntity。您是否已覆盖 AbstractArangoConfiguration.arangoTemplate()
?在这种情况下,您已经删除了底层驱动程序所需的配置。