java - Google Java api - feed.insert(entry) 期间出现错误 "com.google.gdata.util.ServiceException: Bad Gateway"

标签 java google-api google-sheets google-sheets-api google-api-java-client

我的电子表格中有两个工作表。如果满足某些条件,我会将值从一张纸复制并更改为另一张纸。它已经工作了 2 周,从昨天开始就出现了这个问题。没有进行任何更改。执行此语句时会出现下面提到的错误消息。

请注意,此错误并非每次都会出现,并且在迭代一些 for 循环后也会出现错误,有时当 x=10 有时当 x=100 或 x=500 时

导致错误的代码:

 for (int x=1; x <= row_TODAY_WS;x++){
    for(int y=1; y <= col_TODAY_WS;y++){
       CellEntry newEntry = new CellEntry (x, y, feed_cell_0.getEntries().get(i).getPlainTextContent());
       feed_1.insert(newEntry);
      i++;
    }
  }

错误消息:

com.google.gdata.util.ServiceException: Bad Gateway
<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 502 (Server Error)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-heipx 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{cation:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.gors/logo_sm_2.png) no-repeat}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat 0%order-image:url(//www.google.com/images/errors/logo_sm_2_hr.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.goog/logo_sm_2_hr.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:55px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>502.</b> <ins>That?s an error.</ins>
  <p>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.  <ins>That?s all we know.</ins>

        at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:632)
        at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
        at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
        at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
        at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
        at com.google.gdata.client.Service.insert(Service.java:1409)
        at com.google.gdata.client.GoogleService.insert(GoogleService.java:613)
        at com.google.gdata.data.BaseFeed.insert(BaseFeed.java:535)

最佳答案

HTTP error 502 (网关错误)是服务器错误。运行电子表格 API 所涉及的其中一台 Google 服务器似乎存在问题。问题不在于您的代码。

您的计算机连接了 Google 服务器,该服务器充当实际执行工作的服务器的代理。然后,第二个服务器遇到某种问题,这意味着它无法向代理服务器返回有效的响应,然后代理可以将其传回给您。结果,代理服务器向您发送回 HTTP 502 响应。

我希望 Google 的系统足够智能,能够检测到这些问题并自动通知 Google 工程师。也许谷歌的某个人正在研究这个问题。不过,我不在 Google 工作,所以我不能肯定地说这是真的。

如果不出意外,您可以尝试在 Google Spreadsheets API 上发帖。论坛。

关于java - Google Java api - feed.insert(entry) 期间出现错误 "com.google.gdata.util.ServiceException: Bad Gateway",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25763403/

相关文章:

google-sheets - 让东京股票价格数据出现在 Google 电子表格中

java - 如何在 Java 中真正从类路径中读取文本文件

android - 来自 Android 手机的适用于 Google API 的有效 OAuth

php - Google Contacts API 获取电话号码 (PHP)

node.js - Nodejs错误: "User does not have sufficient permissions for this profile "

google-sheets - 如何在数组公式中使用 IFERROR?

java - 使用 OOP 和设计模式创建标准图形构建器

java - org.eclipse.ui 无法解析?

java - 使用 DbUtils BeanListHandler 在可重用 JavaFX 数据检索服务上摸索通用类型

javascript - 谷歌应用脚​​本: Time Driven Triggers timezone issue