2

我正在尝试在我的远程 Linux Amazon AMI 服务器上运行 Java .jar 文件。在本地,当我运行这个 Java 项目时,会建立一个永久的 HTTP 连接,并且一切都按预期工作。如果我在我的服务器上运行它,我会收到一个身份验证错误。我必须通过 OAuth1 进行身份验证才能访问在我的本地计算机上完美运行的 Twitter 服务器。我是否必须在我的服务器上安装一些东西才能支持 OAuth 等?

16214 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.DefaultHttpClient  - Authentication required
16214 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.DefaultHttpClient  - userstream.twitter.com:443 requested authentication
16214 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy  - Authentication schemes in the order of preference: [negotiate, Kerberos, NTLM, Digest, Basic]
16214 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy  - Challenge for negotiate authentication scheme not available
16215 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy  - Challenge for Kerberos authentication scheme not available
16215 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy  - Challenge for NTLM authentication scheme not available
16215 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy  - Challenge for Digest authentication scheme not available
16215 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy  - Challenge for Basic authentication scheme not available
16215 [hosebird-client-io-thread-0] WARN com.twitter.hbc.httpclient.ClientBase  - hosebird-client-0 Error connecting w/ status code - 401, reason - Unauthorized
4

1 回答 1

0

它与您的计算机时钟同步有关。如果在日期和时间首选项上使用 MAC,请选择自动设置日期和时间。这为我解决了这个问题。

如果在 linux 上,请按照以下链接安装“ntp”

https://vandannguyen.wordpress.com/2014/12/02/twitter-error-connecting-w-status-code-401-reason-authorization-required/

于 2016-03-17T20:36:20.850 回答