【问题标题】:ClassNotFoundException OptionsStrategyClassNotFoundException 选项策略
【发布时间】:2019-06-06 11:22:57
【问题描述】:

当我连接到远程服务器并尝试修改图形时,我得到 java.lang.ClassNotFoundException: 线程“main”中的异常 java.lang.NoClassDefFoundError: org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration /选项策略

我尝试搜索有关此异常的信息。我认为这是因为与 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


    【解决方案1】:

    您的版本不匹配。请注意,JanusGraph 0.3.1 绑定到 TinkerPop 3.3.x 代码行:

    https://github.com/JanusGraph/janusgraph/blob/v0.3.1/pom.xml#L72

    直到 3.4.x 代码行才在 TinkerPop 中添加 OptionStrategy(和 related functionality)。因此,JanusGraph 无法处理使用这种功能的请求。

    【讨论】:

    • 它的“非常”信息丰富......现在该怎么办?
    • 要么将 tinkerpop 依赖项降级到 3.3.x(最好是 3.3.3 中使用的显式版本 janus 图,或者自己构建似乎在 3.4.x 上的 master 分支,或者等待发布 JanusGraph 0.4.0 groups.google.com/d/msg/janusgraph-dev/myWnQEhNTPk/V39wZaIvBwAJ
    猜你喜欢
    • 2019-05-21
    • 1970-01-01
    • 1970-01-01
    • 2013-11-15
    • 2019-08-15
    • 1970-01-01
    • 2020-08-20
    • 1970-01-01
    • 2011-11-01
    相关资源
    最近更新 更多