当我连接到远程服务器并尝试修改图形时,我得到 java.lang.ClassNotFoundException: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/OptionsStrategy
我尝试搜索有关此异常的信息。我认为发生这种情况是因为与 janusgraph-core、gremlin-server 和 gremlin-driver 的版本发生冲突
//pom file dependencies
<dependencies>
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-core</artifactId>
<version>0.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-driver</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-server</artifactId>
<version>3.4.2</version>
</dependency>
</dependencies>
//jgex-remote.properties file
gremlin.remote.remoteConnectionClass=org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection
gremlin.remote.driver.sourceName=g
gremlin.remote.driver.clusterFile=.../janus_connect_config.yaml
//janus_connect_config.yaml file
hosts: [xxx.xxx.xxx.xxx]
port: xxxx
serializer: {
className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0,
config: {
ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry]
}
}
// java code
public class App {
public static void main(String[] args) throws ConfigurationException {
if (args.length == 0) {
throw new IllegalArgumentException("Input args must contains path to file with configuration");
}
String configFilePath = args[0];
PropertiesConfiguration connectConfig = new PropertiesConfiguration(configFilePath);
Cluster cluster = null;
Client client = null;
try {
cluster = Cluster.open(connectConfig.getString("gremlin.remote.driver.clusterFile"));
client = cluster.connect();
Bindings b = Bindings.instance();
GraphTraversalSource graph = EmptyGraph.instance()
.traversal()
.withRemote(connectConfig);
Vertex evnyh = graph.addV(b.of("label", "man"))
.property("name", "Evnyh")
.property("family", "Evnyhovich")
.next();
Vertex lalka = graph.addV(b.of("label", "man"))
.property("name", "Lalka")
.property("family", "Lalkovich")
.next();
graph.V(b.of("outV", evnyh)).as("a")
.V(b.of("inV", lalka)).as("b")
.addE(b.of("label", "friend")).from("a")
.next();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (client != null) {
try {
client.close();
} catch (Exception e) {
// nothing to do, just close client
}
}
if (cluster != null) {
try {
cluster.close();
} catch (Exception e) {
// nothing to do, just close cluster
}
}
}
}
}
有人可以帮忙解决这个问题吗?
您的版本不匹配。请注意,JanusGraph 0.3.1 已绑定到 TinkerPop 3.3.x 代码行:
https://github.com/JanusGraph/janusgraph/blob/v0.3.1/pom.xml#L72
和
OptionStrategy
(以及相关功能)直到 3.4.x 代码行才添加到 TinkerPop 中。因此 JanusGraph 无法处理使用此类功能的请求。
我能够连接到 janusgraph 服务器,但通过我的客户端应用程序,我在查询服务器时遇到错误。以下是错误日志... 28 更多 91 [main] INFO org.apache.tinkerpop.gremlin.driver.ConnectionPool - 发出信号关闭主机上的连接池{address=192.168.21.121/192.168.21.121:8182,hostUri=ws://192.168.21.121:8182/gremlin } 核心大小为 1 线程“主”中的异常 java.util.concurrent.CompletionException:io.netty.handler.codec.DecoderException:org.apache.tinkerpop.gremlin.driver.ser.SerializationException:java.lang.IndexOutOfBoundsException:索引:127,大小: 0 在java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:375) 在 java.util.concurrent.CompletableFuture.join(CompletableFuture.java:1934) 在 org.apache.tinkerpop.gremlin.driver.ResultSet.one(ResultSet.java:107) 在 org.apache.tinkerpop.gremlin.driver.ResultSet$1.hasNext(ResultSet.java:159) 在 org.apache.tinkerpop.gremlin.driver.ResultSet$1.next(ResultSet.java:166) 在 org.apache.tinkerpop.gremlin.driver.ResultSet$1.next(ResultSet.java:153) 在 org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteTraversal$TraverserIterator.next(DriverRemoteTraversal.java:142) 在 org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteTraversal$TraverserIterator.next(DriverRemoteTraversal.java:127) 在org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteTraversal.nextTraverser(DriverRemoteTraversal.java:108) 在 org.apache.tinkerpop.gremlin.process.remote.traversal.step.map.RemoteStep.processNextStart(RemoteStep.java:80) 在 org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:129) 在 org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:39) 在 org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.next(DefaultTraversal.java:204) 在 com.janus.graph.App.main(App.java:33) 如何解决序列化问题。