我使用下面的API来获取2.0.12中的顶点并且它正在工作
OrientGraphFactory factory = new OrientGraphFactory(" remote:172.21.112.228/mydb" ;," root"," root")。setupPool(1,50); OrientGraphNoTx graph = factory.getNoTx(); graph.getVertices(" Test.name"" ZYX&#34);
但是最新的2.2.18,当我尝试
时OrientGraphFactory factory = new OrientGraphFactory(" memory:172.21.112.228 / model"," root"," root")。setupPool(1,50); OrientGraphNoTx graph = factory.getNoTx(); graph.getVertices(" Test.name"" ZYX&#34);
我收到以下错误,
线程中的异常" main" java.lang.IllegalArgumentException:在架构中找不到OClass:Test 在com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.getVertices(OrientBaseGraph.java:814) at test.GetOrientDBData.main(GetOrientDBData.java:57)
答案 0 :(得分:0)
请尝试以下代码:
OrientGraphFactory factory = new OrientGraphFactory("memory:mydb",
"root", "root").setupPool(1,50);
OrientGraphNoTx graph = factory.getNoTx();
if(g.getVertexType("Test") == null){
g.createVertexType("Test");
}
graph.getVertices("Test.name","zyx");
您的代码有两处更改:
删除了内存中的IP:URL,不需要
添加了一项检查,以确保Test类存在,并在创建它时