<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: getText method is not available while working with Spark Twitter streaming in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/getText-method-is-not-available-while-working-with-Spark/m-p/56331#M62207</link>
    <description>You still need the spark-streaming dependency, but instead of version 2.1.1 you will want to match your spark core version of 1.6.3.</description>
    <pubDate>Thu, 22 Jun 2017 20:41:38 GMT</pubDate>
    <dc:creator>hubbarja</dc:creator>
    <dc:date>2017-06-22T20:41:38Z</dc:date>
    <item>
      <title>getText method is not available while working with Spark Twitter streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/getText-method-is-not-available-while-working-with-Spark/m-p/55368#M62204</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Im working on a spark&amp;nbsp;streaming program on Twitter data. In my code,&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;object TwitterDataAnalysis {
  def main(args: Array[String]) {
    if(args.length &amp;lt; 4) {
      System.err.println("Usage: TwitterPopularTags &amp;lt;consumer key&amp;gt; &amp;lt;consumer secret&amp;gt; " +
                          "&amp;lt;access token&amp;gt; &amp;lt;access token secret&amp;gt; [&amp;lt;filters&amp;gt;]")
      System.exit(1)
    }
    val Array(consumerKey, consumerSecret, accessToken, accessTokenSecret) = args.take(4)
    val filters = args.takeRight(args.length - 4)    
    System.setProperty("twitter4j.oauth.consumerKey", consumerKey)
    System.setProperty("twitter4j.oauth.consumerSecret", consumerSecret)
    System.setProperty("twitter4j.oauth.accessToken", accessToken)
    System.setProperty("twitter4j.oauth.accessTokenSecret", accessTokenSecret)    
    val sparkConf = new SparkConf().setAppName("Twitter's trending HashTags").setMaster("local[2]")
    val ssc       = new StreamingContext(sparkConf,Seconds(5))
    val stream    = TwitterUtils.createStream(ssc, None, filters)
    val tweets    = stream.flatMap(tweet =&amp;gt; tweet.getText.split(" ")).filter(_.startsWith("#"))
  }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I haven't completed the program as Im getting an error with the line: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; val tweets = stream.flatMap(tweet =&amp;gt; tweet.getText.split(" ")).filter(_.startsWith("#"))&lt;/PRE&gt;&lt;P&gt;It says:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;value getText is not a member of type parameter T&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;These are the dependencies in my pom.xml file.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt; &amp;lt;!-- Spark Dependency --&amp;gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.apache.spark&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;spark-core_2.10&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;1.6.0&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;

&amp;lt;!-- https://mvnrepository.com/artifact/org.twitter4j/twitter4j-stream --&amp;gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.twitter4j&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;twitter4j-stream&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;4.0.6&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;

&amp;lt;!-- https://mvnrepository.com/artifact/org.apache.spark/spark-streaming-twitter_2.10 --&amp;gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.apache.spark&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;spark-streaming-twitter_2.10&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;1.6.3&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;

&amp;lt;!-- https://mvnrepository.com/artifact/org.apache.spark/spark-streaming_2.10 --&amp;gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.apache.spark&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;spark-streaming_2.10&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;2.1.1&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;My import statements:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;import org.apache.spark.streaming.{Seconds, StreamingContext}
import org.apache.spark.SparkContext
import org.apache.spark.streaming.twitter._
import org.apache.spark.SparkConf
import StreamingContext._&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Can anyone tell what is the mistake Im doing ? I couldn't go further the bolded line as Im not getting functions after that. Is there anything I need to change in the code ?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 11:41:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/getText-method-is-not-available-while-working-with-Spark/m-p/55368#M62204</guid>
      <dc:creator>Sidhartha</dc:creator>
      <dc:date>2022-09-16T11:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: getText method is not available while working with Spark Twitter streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/getText-method-is-not-available-while-working-with-Spark/m-p/55794#M62205</link>
      <description>&lt;P&gt;Hi Sidhartha,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It appears you are using a newer version of spark-streaming (2.1.1). &amp;nbsp;The spark streaming twitter includes spark streaming 1.6.3 and you are using spark 1.6, this may be causing conflicts. &amp;nbsp;There is no need to include the spark-streaming dependency as it will be pulled in with the&amp;nbsp;spark streaming twitter as a transitive dependency.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jason&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 16:20:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/getText-method-is-not-available-while-working-with-Spark/m-p/55794#M62205</guid>
      <dc:creator>hubbarja</dc:creator>
      <dc:date>2017-06-13T16:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: getText method is not available while working with Spark Twitter streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/getText-method-is-not-available-while-working-with-Spark/m-p/56310#M62206</link>
      <description>&lt;P&gt;Okay. So what are the Jar files that I need to change. I meant,&amp;nbsp;match the versions. Because if I remove the spark-streaming dependency, Im getting error at this line:&lt;/P&gt;&lt;PRE&gt;val ssc       = new StreamingContext(sparkConf,Seconds(5))
msg: not found: type StreamingContext&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Jun 2017 14:17:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/getText-method-is-not-available-while-working-with-Spark/m-p/56310#M62206</guid>
      <dc:creator>Sidhartha</dc:creator>
      <dc:date>2017-06-22T14:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: getText method is not available while working with Spark Twitter streaming</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/getText-method-is-not-available-while-working-with-Spark/m-p/56331#M62207</link>
      <description>You still need the spark-streaming dependency, but instead of version 2.1.1 you will want to match your spark core version of 1.6.3.</description>
      <pubDate>Thu, 22 Jun 2017 20:41:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/getText-method-is-not-available-while-working-with-Spark/m-p/56331#M62207</guid>
      <dc:creator>hubbarja</dc:creator>
      <dc:date>2017-06-22T20:41:38Z</dc:date>
    </item>
  </channel>
</rss>

