Idea连接HugeGraph报EXCLUDE_EMPTY错误
一、错误内容
Exception in thread "main" java.lang.NoSuchFieldError: EXCLUDE_EMPTY at org.glassfish.jersey.client.ClientConfig$State.<init>(ClientConfig.java:150) at org.glassfish.jersey.client.ClientConfig.<init>(ClientConfig.java:468) at com.baidu.hugegraph.rest.AbstractRestClient$ConfigBuilder.<init>(AbstractRestClient.java:419) at com.baidu.hugegraph.rest.AbstractRestClient.<init>(AbstractRestClient.java:117) at com.baidu.hugegraph.client.RestClient.<init>(RestClient.java:55) at com.baidu.hugegraph.driver.HugeClient.<init>(HugeClient.java:59) at com.baidu.hugegraph.driver.HugeClientBuilder.build(HugeClientBuilder.java:70) at com.meiyijia.pd.flink.hugeGraph.BatchExample.main(BatchExample.java:26)
二、报错场景
public class BatchExample { public static void main(String[] args) { try { HugeClient hugeClient = HugeClient.builder("http://192.168.66.83:8080", "meta_hugegraph") .configTimeout(20) // 默认 20s 超时 .configUser("**", "**") // 默认未开启用户权限 .build(); System.out.println(hugeClient); SchemaManager schema = hugeClient.schema(); PropertyKey name = schema.getPropertyKey("name"); System.out.println(name); }catch (Exception e){ e.printStackTrace(); } } }
<dependency> <groupId>com.baidu.hugegraph</groupId> <artifactId>hugegraph-client</artifactId> <version>1.9.0</version> </dependency>
三、解决思路
看上去像是版本问题,百度也找不出答案,最后把Maven依赖调换的一下顺序就好了,我这个老工程依赖比较多,我添加hugegraph-client依赖的时候习惯性的把它放到pom文件的末尾,所以运行程序就报错了,看来有些时候姿势不对也进不去啊
解决:将依赖放置pom文件的最前面即可