Java 大查询API异常

Java 大查询API异常,java,guava,Java,Guava,我有这个问题 java.lang.NoSuchMethodError:com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor 而使用谷歌的大查询API 我正在使用JSF,GlassFish 4.1 我的方法正在引发异常: public void process() throws InterruptedException, FileNotFoundException

我有这个问题

java.lang.NoSuchMethodError:com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor

而使用谷歌的大查询API

我正在使用JSF,GlassFish 4.1

我的方法正在引发异常:

public void process() throws InterruptedException, FileNotFoundException, IOException {
   GoogleCredentials credentials;
    File credentialsPath = new File("/home/jesus_miranda/Downloads/credential2.json");  // TODO: update to your key path.
    try (FileInputStream serviceAccountStream = new FileInputStream(credentialsPath)) {
        credentials = ServiceAccountCredentials.fromStream(serviceAccountStream);
    }
    // Instantiate a client.
    BigQuery bigquery = BigQueryOptions.newBuilder().setCredentials(credentials).build().getService();
    String query = "SELECT corpus FROM `bigquery-public-data.samples.shakespeare` GROUP BY corpus;";
    QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(query).build();

    for (FieldValueList row : bigquery.query(queryConfig).iterateAll()) {//At this line the program failed.
        for (FieldValue val : row) {
            System.out.printf("%s,", val.toString());
        }
        System.out.printf("\n");
    }
}
请帮帮我,我读了很多论坛,都是关于番石榴的。我更新并降级了番石榴的版本,但仍然不起作用

问候

  • 这个问题似乎是版本不匹配造成的。查看BigQueryAPI的依赖项声明,看看使用的是哪个Guava版本

  • 也许您正在构建应用程序,但忘记了在罐子中涂抹/涂抹番石榴