我使用的是在github上传的cloudera flume-sources-1.0-SNAPSHOT提供的资源。
我收到的错误如下。在twitter4j中cloudera提供的jar的configuration.class中不存在该方法。
如何解决这个问题?
{
14/06/12 03:04:56 INFO node.PollingPropertiesFileConfigurationProvider: Configuration provider starting
14/06/12 03:04:56 INFO node.PollingPropertiesFileConfigurationProvider: Reloading configuration file:conf/tagent
14/06/12 03:04:56 INFO conf.FlumeConfiguration: Processing:HDFS
14/06/12 03:04:56 INFO conf.FlumeConfiguration: Processing:HDFS
14/06/12 03:04:56 INFO conf.FlumeConfiguration: Processing:HDFS
14/06/12 03:04:56 INFO conf.FlumeConfiguration: Added sinks: HDFS Agent: TwitterAgent
14/06/12 03:04:56 INFO conf.FlumeConfiguration: Processing:HDFS
14/06/12 03:04:56 INFO conf.FlumeConfiguration: Processing:HDFS
14/06/12 03:04:56 INFO conf.FlumeConfiguration: Processing:HDFS
14/06/12 03:04:56 INFO conf.FlumeConfiguration: Processing:HDFS
14/06/12 03:04:56 INFO conf.FlumeConfiguration: Processing:HDFS
14/06/12 03:04:56 INFO conf.FlumeConfiguration: Post-validation flume configuration contains configuration for agents: [TwitterAgent]
14/06/12 03:04:56 INFO node.AbstractConfigurationProvider: Creating channels
14/06/12 03:04:56 INFO channel.DefaultChannelFactory: Creating instance of channel MemChannel type memory
14/06/12 03:04:57 INFO node.AbstractConfigurationProvider: Created channel MemChannel
14/06/12 03:04:57 INFO source.DefaultSourceFactory: Creating instance of source Twitter, type com.cloudera.flume.source.TwitterSource
14/06/12 03:04:57 ERROR node.PollingPropertiesFileConfigurationProvider: Unhandled error
java.lang.NoSuchMethodError: twitter4j.conf.Configuration.getRequestHeaders()Ljava/util/Map;
at twitter4j.StreamingReadTimeoutConfiguration.getRequestHeaders(TwitterStreamImpl.java:664)
at twitter4j.internal.http.HttpClientWrapper.<init>(HttpClientWrapper.java:47)
at twitter4j.TwitterStreamImpl.<init>(TwitterStreamImpl.java:54)
at twitter4j.TwitterStreamFactory.<clinit>(TwitterStreamFactory.java:40)
at com.cloudera.flume.source.TwitterSource.<init>(TwitterSource.java:64)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.apache.flume.source.DefaultSourceFactory.create(DefaultSourceFactory.java:42)
at org.apache.flume.node.AbstractConfigurationProvider.loadSources(AbstractConfigurationProvider.java:327)
at org.apache.flume.node.AbstractConfigurationProvider.getConfiguration(AbstractConfigurationProvider.java:102)
at org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable.run(PollingPropertiesFileConfigurationProvider.java:140)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
}
答案 0 :(得分:1)
检查您正在使用的twitter4j jars版本。
twitter4j.conf.Configuration.getRequestHeaders()方法不是最新版本。
但它在twitter4j 2.x
答案 1 :(得分:0)
您必须用flume/lib
版本替换放置在twitter4j-2.x.x
文件夹中的所有twitter4j-3.0.3库。原因是同一个班级名称在twitter4j-3.0.3
和flume-sources-1.0-SNAPSHOT.jar
要避免这种情况,您必须通过将以下属性放在twitter4j.properties
作为类路径来对twitter4j属性进行更改:
streamBaseURL=https://stream.twitter.com/1.1/ `
或您可以从here下载新的flume-source-1.0-snapshot.jar。
此问题已由Twitter社区解决,有关完整说明,您可以查看this discussion。
答案 2 :(得分:0)
收到时
twitter4j.conf.Configuration.getRequestHeaders() method error.
尝试以下步骤,它解决了我的问题。
/usr/lib/flume-ng/lib/ directory
中删除以下3个jar文件。
/usr/lib/flume-ng/lib/ directory
。twitter4j
个jar应该是最新版本。)