0

最近、「不明な認証ヘッダー」例外が原因で、回帰テストで約 30% の API 呼び出しが失敗しています。gdata Java SDK から次の例外が発生しています。

Caused By AuthenticationException:

com.google.gdata.util.AuthenticationException: Unknown authorization header
<HTML>
<HEAD>
<TITLE>Unknown authorization header</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unknown authorization header</H1>
<H2>Error 401</H2>
</BODY>
</HTML>

at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:600)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:552)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)
at com.google.gdata.client.Service.getFeed(Service.java:1135)
at com.google.gdata.client.Service.getFeed(Service.java:998)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:631)
at com.google.gdata.client.Service.getFeed(Service.java:1017)

テスト ケースごとに 20 以上の JVM を使用して、gdata API を使用して回帰テストを実行しています。このエラーは新しいものです。実装を変更することなく、また負荷を大幅に変更することなく出現しました。ただし、同時実行 JVM の数を変更すると、エラー率もそれに応じて変化し、JVM の数を数個に減らすと、約 10% のエラー率に低下します。

エラーの原因と可能な修正方法について、ご意見をお寄せいただければ幸いです。

ありがとうアサフ

4

1 に答える 1

0
    private DocsService getDocsService(boolean withHeader) {

    DocsService docsService = new DocsService(APP_NAME);

    try {

        docsService.setOAuthCredentials(getAuthParameters(),
                new OAuthHmacSha1Signer());

        if (withHeader) {
            docsService.getRequestFactory().setHeader("If-Match", "*");
        }

        return docsService;

    } catch (OAuthException oAuthException) {

        throw new TestFlowException(
                "Failed to set Google Drive Oauth Credentials",
                oAuthException);
    }

}

private GoogleOAuthParameters getAuthParameters() {

    GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();

    oauthParameters.setOAuthConsumerKey(GOOGLE_DRIVE_KEY.getKey());
    oauthParameters.setOAuthConsumerSecret(GOOGLE_DRIVE_KEY.getSecret());
    oauthParameters.setOAuthToken(ACCESS_CREDENTIALS.getKey());
    oauthParameters.setOAuthTokenSecret(ACCESS_CREDENTIALS.getPassword());

    return oauthParameters;
}
于 2012-08-24T19:26:47.780 に答える