当前位置: 首页 > 知识库问答 >
问题:

Apache Flume连接到twitter API 401:身份验证凭据

阎晗日
2023-03-14

我正在尝试使用Apache Flume将推文保存到HDFS。我目前在Hadoop和Flume中使用Cloudera图像。我在Cloudera的博客上学习教程,但我无法连接到Twitter API。

我收到以下错误:

2014-03-14 09:43:14,021 INFO org.apache.flume.node.Application: Waiting for channel: MemChannel to start. Sleeping for 500 ms
2014-03-14 09:43:14,069 INFO org.apache.flume.instrumentation.MonitoredCounterGroup: Monitored counter group for type: CHANNEL, name: MemChannel: Successfully registered new MBean.
2014-03-14 09:43:14,069 INFO org.apache.flume.instrumentation.MonitoredCounterGroup: Component type: CHANNEL, name: MemChannel started
2014-03-14 09:43:14,522 INFO org.apache.flume.node.Application: Starting Sink HDFS
2014-03-14 09:43:14,522 INFO org.apache.flume.node.Application: Starting Source Twitter
2014-03-14 09:43:14,525 INFO org.apache.flume.instrumentation.MonitoredCounterGroup: Monitored counter group for type: SINK, name: HDFS: Successfully registered new MBean.
2014-03-14 09:43:14,525 INFO org.apache.flume.instrumentation.MonitoredCounterGroup: Component type: SINK, name: HDFS started
2014-03-14 09:43:14,595 INFO twitter4j.TwitterStreamImpl: Establishing connection.
2014-03-14 09:43:14,680 INFO org.mortbay.log: Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog
2014-03-14 09:43:14,823 INFO org.mortbay.log: jetty-6.1.26
2014-03-14 09:43:14,946 INFO org.mortbay.log: Started SocketConnector@0.0.0.0:41414
2014-03-14 09:43:16,249 INFO twitter4j.TwitterStreamImpl: 401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync.

HTTP ERROR: 401

Problem accessing '/1.1/statuses/filter.json'. Reason:
Unauthorized



2014-03-14 09:43:16,249 INFO twitter4j.TwitterStreamImpl: Waiting for 10000 milliseconds
2014-03-14 09:43:26,251 INFO twitter4j.TwitterStreamImpl: Establishing

我已经将我的twitter API凭证复制到flume.conf中(我已经在光盘和web用户界面上进行了尝试)。我也曾试图重新生成它们,并复制那些新的,但这对我没有帮助。

我的pom。xml包含:

<dependency>
  <groupId>org.twitter4j</groupId>
  <artifactId>twitter4j-stream</artifactId>
  <version>3.0.5</version>
</dependency>

这意味着不应该有这里描述的问题。

我还通过命令设置了系统时间:

sudo ntpdate pool.ntp.org

有人知道哪里可能出了问题吗?提前非常感谢大家的任何建议和帮助。

共有2个答案

程天佑
2023-03-14

更新:这是因为用户密钥/机密、访问令牌/机密无效,请确保系统时钟同步。“

陆海阳
2023-03-14

尝试升级到Twitter4J 3.0.6。我通过升级到3.0.6解决了类似问题

 类似资料:
  • 我对社交网络分析和twitter api是新手。我想收集关于特定主题的tweets。所以我写了下面的代码 在我的程序中,我需要在哪里提供凭据 谢谢

  • 问题内容: 实用程序类中有一个静态方法,该方法将从URL下载文件。已经设置了身份验证器,以便如果需要用户名和密码,则可以检索凭据。问题是,只要凭据有效,来自第一个成功连接的凭据将用于每个连接后缀。这是一个问题,因为我们的代码是多用户的,并且由于没有为每个连接检查凭据,所以没有适当凭据的用户可能会下载文件。 这是我们正在使用的代码 第一次下载文件时,我只从getPasswordAuthenticat

  • 我试图在一个反应式Spring Boot应用程序中配置一个Spring Security性,该应用程序具有一个Vuejs前端,在未经身份验证时将用户重定向到外部OpenID提供程序(用于身份验证)。在用户通过OpenID提供程序进行身份验证并重定向回应用程序(前端)后,将根据OpenID提供程序的响应创建用户名密码身份验证令牌(身份验证),并手动进行身份验证。 但是,在执行此操作时,应用程序似乎无

  • 我尝试在Angular上添加身份验证(使用云firestore作为数据库)。这里我更改了数据库的规则 现在,当我登录时,我在控制台中接收到这作为一个输出 https://ibb.co/dkzdqhd 我在我的凭据中接收到null值,我继续到我的组件,在那里我从数据库中读取数据并显示它们。我接收到错误为 core.js:12501错误FirebaseError:权限缺失或不足。位于new Fires

  • 问题内容: 我正在尝试使用kerberos / HTTP主机进行身份验证。使用Apache HttpClient作为我的客户端- 以及此源的略微修改版本。 我的Kerberos身份验证非常顺利,我希望知道如何以编程方式设置登录凭据。目前,凭据是通过控制台手动输入的,但是我想在运行时选择它。[实际上,正如我希望对大量用户进行自动化和负载测试的服务器。]。 编辑:这是相关部分的代码片段: 该接口有两种