Idea連線HugeGraph報EXCLUDE_EMPTY錯誤
阿新 • • 發佈:2022-05-12
一、錯誤內容
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檔案的最前面即可