我正在运行以下java代码(对此处发布的示例进行非常小的修改https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-java.html)并获取空指针异常。我看到顶点是在海王星中创建的,但是驱动程序似乎会对响应进行轰炸。
我在这里做错了吗?是否有人使用Java以编程方式在Neptune中创建顶点。
public class NeptuneMain {
public static void main(String[] args) {
Cluster.Builder builder = Cluster.build();
builder.addContactPoint("<enter cluster url here>");
builder.port(8182);
Cluster cluster = builder.create();
GraphTraversalSource g = EmptyGraph.instance().traversal().withRemote(DriverRemoteConnection.using(cluster));
GraphTraversal t = g.addV("Aspect");
t.forEachRemaining(
e -> System.out.println(e)
);
cluster.close();
}
}
堆栈跟踪是:
Exception in thread "main" java.util.concurrent.CompletionException: java.lang.NullPointerException
at java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:375)
at java.util.concurrent.CompletableFuture.join(CompletableFuture.java:1934)
at org.apache.tinkerpop.gremlin.driver.ResultSet.one(ResultSet.java:107)
at org.apache.tinkerpop.gremlin.driver.ResultSet$1.hasNext(ResultSet.java:159)
at org.apache.tinkerpop.gremlin.driver.ResultSet$1.next(ResultSet.java:166)
at org.apache.tinkerpop.gremlin.driver.ResultSet$1.next(ResultSet.java:153)
at org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteTraversal$TraverserIterator.next(DriverRemoteTraversal.java:142)
at
答案 0 :(得分:0)
您可能正在使用gremlin-driver软件包的旧版本(3.2.x)。尝试升级到&gt; = 3.3.2,如果您仍然发现此问题,请告诉我们。