首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ClassNotFoundException OptionsStrategy

ClassNotFoundException OptionsStrategy
EN

Stack Overflow用户
提问于 2019-06-06 19:22:57
回答 1查看 196关注 0票数 0

当我连接到远程服务器并试图修改图形时,我在线程"main“中得到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的版本冲突

代码语言:javascript
复制
//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>
代码语言:javascript
复制
//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
代码语言:javascript
复制
//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]
  }
}
代码语言:javascript
复制
// 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
                }
            }
        }
    }
}

有人能帮助解决这个问题吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-06-07 20:24:18

您的版本不匹配。请注意,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不能处理使用这种功能的请求。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56476552

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档