Java驱动程序抛出错误

时间:2015-10-14 04:46:02

标签: java arangodb

尝试将ArangoDB (2.7.0)与Java驱动程序2.6.8一起使用时,我遇到了错误。想知道我是否遗漏了一些显而易见的事情。

此外,如果下面的错误报告了无法找到的集合名称,那将是非常好的,这与Oracle未找到的表格#34;并且花费大量时间来确定在使用大型存储过程时丢失哪个表。

CollectionEntity vCollection = arangoDriver.createCollection("vertexCollection", new CollectionOptions().setType(CollectionType.DOCUMENT));
CollectionEntity eCollection = arangoDriver.createCollection("edgeCollection", new CollectionOptions().setType(CollectionType.EDGE));

List<EdgeDefinitionEntity> edgeDefinitions = new ArrayList<>();
EdgeDefinitionEntity edgeDefinition = new EdgeDefinitionEntity();
edgeDefinition.setCollection("edgeCollection");

List<String> from = new ArrayList<>();
from.add("vertexCollection");
edgeDefinition.setFrom(from);

List<String> to = new ArrayList<>();
to.add("vertexCollection");
edgeDefinition.setTo(to);

GraphEntity graph = arangoDriver.createGraph("myGraph", edgeDefinitions, null, true);

VertexEntity<Object> v1 = arangoDriver.graphCreateVertex("myGraph", "vertexCollection", new Object(), true);

arangoDriver.graphCreateVertex(...)投掷如下:

2015-10-14 07:42:59.930 [main] DEBUG com.arangodb.http.HttpManager - [REQ]http-POST: url=http://127.0.0.1:8529/_db/sphere/_api/gharial/myGraph/vertex/vertexCollection?waitForSync=true, headers=null, body={}
2015-10-14 07:42:59.940 [main] DEBUG com.arangodb.http.HttpManager - [RES]http-POST: statusCode=404
2015-10-14 07:42:59.941 [main] DEBUG com.arangodb.http.HttpManager - [RES]http-POST: text={"error":true,"code":404,"errorNum":1203,"errorMessage":"collection not found"}
Exception in thread "main" com.arangodb.ArangoException: [1203] collection not found
    at com.arangodb.BaseArangoDriver.createEntity(BaseArangoDriver.java:262)
    at com.arangodb.BaseArangoDriver.createEntity(BaseArangoDriver.java:314)
    at com.arangodb.impl.InternalGraphDriverImpl.createVertex(InternalGraphDriverImpl.java:332)
    at com.arangodb.impl.InternalGraphDriverImpl.createVertex(InternalGraphDriverImpl.java:294)
    at com.arangodb.ArangoDriver.graphCreateVertex(ArangoDriver.java:4455)

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

根据reply,以下声明丢失了!

edgeDefinitions.add(edgeDefinition);

现在有效。