I was using below API for fetching the vertex in 2.0.12 and it was working
OrientGraphFactory factory = new OrientGraphFactory("remote:172.21.112.228/mydb", "root", "root").setupPool(1,50);
OrientGraphNoTx graph = factory.getNoTx();
graph.getVertices("Test.name","zyx");
But with the latest 2.2.18, when I tried with
OrientGraphFactory factory = new OrientGraphFactory("memory:172.21.112.228/mydb", "root", "root").setupPool(1,50);
OrientGraphNoTx graph = factory.getNoTx();
graph.getVertices("Test.name","zyx");
I am getting below error,
Exception in thread "main" java.lang.IllegalArgumentException:
OClass not found in the schema: Test
at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.getVertices(OrientBaseGraph.java:814)
at test.GetOrientDBData.main(GetOrientDBData.java:57)
Try following code:
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");
Two changes on your code:
removed the IP in the memory: URL, no need for that
added a check to make sure that Test class exists and in case create it