Flume Twitter 数据流设置问题



我在CDH4上使用Flume提取Twitter数据时遇到以下异常。

推特4j.TwitterStreamImpl:正在接收状态流。中的异常 thread "Twitter4J Async Dispatcher[0]" java.lang.NoSuchMethodError: twitter4j.json.JSONObjectType.determine(Ltwitter4j/internal/org/json/JSONObject;)Ltwitter4j/json/JSONObjectType; 在 推特4j.AbstractStreamImplementation$1.run(AbstractStreamImplementation.java:100) 在 twitter4j.internal.async.ExecuteThread.run(DispatcherImpl.java:116)

我在代码中遇到了同样的问题,但是当我将.jar从 twitter4j-core-2.2.6.jar 更改为 twitter4j-stream-3.0.0.jar 时,它得到了解决。

此问题背后的主要原因是由于代码中使用了FilterQuery fq = new FilterQuery();并且FilterQuery类存在于twitter4j-core-2.2.6.jar中,但它存在一些问题,因此问题即将到来。如果我们将twitter4j-core-2.2.6.jar替换为twitter4j-stream-3.0.0.jar则它还包含FilterQuery类并且问题得到解决。

最新更新