我正在尝试使用Apache Flume将推文保存到我的HDFS中。我目前正在将Cloudera镜像与Hadoop和Flume一起使用。我一直在关注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 [email protected]: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 UI上都尝试过)。我也尝试过重新生成它们并复制那些新的,但是这并没有帮助我。

我的pom.xml包含:
<dependency>
  <groupId>org.twitter4j</groupId>
  <artifactId>twitter4j-stream</artifactId>
  <version>3.0.5</version>
</dependency>

这意味着不应存在here描述的问题。

我还通过命令设置了系统时间:
sudo ntpdate pool.ntp.org

有人对什么可能是错有什么想法?
非常感谢您的任何建议和帮助。

最佳答案

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

关于hadoop - Apache Flume与Twitter API 401的连接:身份验证凭据,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22411491/

10-13 09:07