ClassNotFoundException OptionsStrategy - PullRequest
0 голосов
/ 06 июня 2019

Когда я подключаюсь к удаленному серверу и пытаюсь изменить график, я получаю java.lang.ClassNotFoundException: исключение в потоке "main" / 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
                }
            }
        }
    }
}

Может кто-нибудь помочь решить эту проблему?

1 Ответ

2 голосов
/ 07 июня 2019

У вас несоответствие версии. Обратите внимание, что JanusGraph 0.3.1 привязан к строке кода TinkerPop 3.3.x:

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

и OptionStrategy связанная функциональность ) не были добавлены в TinkerPop до строки кода 3.4.x. Поэтому JanusGraph не может обрабатывать запросы, которые используют такую ​​функциональность.

...