首页 > 其他分享 >HugeGraph创建propertyKey出现The name of property key can't be null

HugeGraph创建propertyKey出现The name of property key can't be null

时间:2022-10-10 09:55:07浏览次数:75  
标签:baidu java name HugeGraph hugegraph import hugeClient null com

1、发生错误场景(开发环境)

import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.baidu.hugegraph.driver.GremlinManager;
import com.baidu.hugegraph.driver.HugeClient;
import com.baidu.hugegraph.driver.SchemaManager;
public class SingleExample {
    public static void main(String[] args) throws IOException {
        HugeClient hugeClient = null;
        try {
            // If connect failed will throw a exception.
            hugeClient = HugeClient.builder("http://192.168.66.83:8080",
                    "hugegraph")
                    .build();
            SchemaManager schema = hugeClient.schema();
            schema.propertyKey("aaa3").asText().valueSingle().ifNotExist().create();
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            hugeClient.close();
        }
    }
}

2、发生错误时的报错内容

Caused by: com.baidu.hugegraph.exception.ServerException: The name of property key can't be null

3、解决

  fastjson依赖冲突导致,将依赖替换为1.1.X版本即可,我这边替换为1.1.45版本后,再次运行就好了

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>fastjson</artifactId>
    <version>1.1.45</version>
</dependency>

4、参考地址:https://github.com/apache/incubator-hugegraph/issues/5

标签:baidu,java,name,HugeGraph,hugegraph,import,hugeClient,null,com
From: https://www.cnblogs.com/qq1035807396/p/16774602.html

相关文章