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

时间:2014-03-14 17:08:04

标签: hadoop twitter cloudera flume cloudera-manager

我正在尝试使用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(我已在光盘和网络用户界面中尝试过)。我还试图再次重新生成它们并复制那些新的,但它对我没有帮助。

我的pom.xml包含:

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

这意味着不应该是here所描述的问题。

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

sudo ntpdate pool.ntp.org

有没有人知道可能出现什么问题? 非常感谢您提出任何建议和帮助。

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

更新: 它是因为无效的消费者密钥/秘密,访问令牌/秘密,并确保系统时钟同步。“