我正在开发一个App Engine应用程序来从BigQuery进行查询。当我创建一个bigquery实例并在此之后我想要创建数据集或获取对数据集的引用时,会发生以下错误。这只发生在我在App Engine上部署应用程序但是当我使用本地应用程序引擎sdk来测试我的应用程序时我没有任何问题
java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;
at com.google.api.gax.retrying.BasicRetryingFuture.<init> (BasicRetryingFuture.java:77)
at com.google.api.gax.retrying.DirectRetryingExecutor.createFuture (DirectRetryingExecutor.java:75)
at com.google.cloud.RetryHelper.runWithRetries (RetryHelper.java:53)
at com.google.cloud.bigquery.BigQueryImpl.getDataset (BigQueryImpl.java:227)
at com.google.cloud.bigquery.BigQueryImpl.getDataset (BigQueryImpl.java:218)
at com.example.Edmonds.myapplication.backend.MyServlet.doGet (MyServlet.java:75)
at javax.servlet.http.HttpServlet.service (HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service (HttpServlet.java:717)
我尝试这样做的部分如下:
InputStream ios = getServletContext().getResourceAsStream("/WEB-INF/BackendTestMac-f8739513cc27.json") ;
FirebaseOptions options = new FirebaseOptions.Builder()
.setServiceAccount(getServletContext().getResourceAsStream("/WEB-INF/BackendTestMac-f8739513cc27.json"))
.setDatabaseUrl("https://backendtestmac.firebaseio.com/")
.build();
BigQuery bigQuery = BigQueryOptions.newBuilder().setProjectId("backendtestmac").setCredentials(ServiceAccountCredentials.fromStream(ios)).build().getService() ;
String datasetId = "my_dataset_id";
Dataset dataset = bigQuery.create(DatasetInfo.newBuilder(datasetId).build()) ;
答案 0 :(得分:0)
我正在做标准的应用引擎教程并遇到类似的例外:
在页面上:
Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds
在服务器日志中
Error for /create
java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;
at com.google.api.gax.retrying.BasicRetryingFuture.<init>(BasicRetryingFuture.java:77)
at com.google.api.gax.retrying.DirectRetryingExecutor.createFuture(DirectRetryingExecutor.java:75)
at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:53)
at com.google.cloud.storage.StorageImpl.create(StorageImpl.java:148)
at com.google.cloud.storage.StorageImpl.create(StorageImpl.java:141)
at com.example.getstarted.util.CloudStorageHelper.uploadFile(CloudStorageHelper.java:65)
at com.example.getstarted.basicactions.CreateBookServlet.doPost(CreateBookServlet.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at com.example.getstarted.util.DatastoreSessionFilter.doFilter(DatastoreSessionFilter.java:98)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:37)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60)
上传图片时,它在本地运行良好,但在升级为appspot
时损坏但是,在用户身份验证部分之后,我登录后,我没有收到错误。如果是匿名的 - 得到了那个错误。可能它最近在一个补丁中被打破了。因为我认为他们不会在没有提及的情况下发布核心教程。
教程链接是:https://cloud.google.com/java/getting-started-appengine-standard/tutorial-app
也许这有帮助。 Lemme知道你是否再找到了!
答案 1 :(得分:0)
您应该检查应用的类路径。很可能你的CP上有旧版的番石榴