You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by david <da...@free.fr> on 2014/12/11 10:24:13 UTC

Spark steaming : work with collect() but not without collect()

Hi,

  We use the following Spark Streaming code to collect and process Kafka
event :

    kafkaStream.foreachRDD(rdd => {
      rdd.collect().foreach(event => {
          process(event._1, event._2)
      })
    })

This work fine.

But without /collect()/ function, the following exception is raised for call
to function process:
    *Loss was due to java.lang.ExceptionInInitializerError*


  We attempt to rewrite like this but the same exception is raised :

     kafkaStream.foreachRDD(rdd => {
      rdd.foreachPartition(iter =>
        iter.foreach (event => {
        process(event._1, event._2)
      })
      )
    })
    

Does anybody can explain to us why and how to solve this issue ?

Thank's

Regards






--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Spark-steaming-work-with-collect-but-not-without-collect-tp20622.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Re: Spark steaming : work with collect() but not without collect()

Posted by Tathagata Das <ta...@gmail.com>.
What does process do? Maybe when this process function is being run in
the Spark executor, it is causing the some static initialization,
which fails causing this exception. For Oracle documentation,
an ExceptionInInitializerError is thrown to indicate that an exception
occurred during evaluation of a static initializer or the initializer
for a static variable.

TD

On Thu, Dec 11, 2014 at 1:36 AM, Gerard Maas <ge...@gmail.com> wrote:
> Have you tried with  kafkaStream.foreachRDD(rdd => {rdd.foreach(...)} ?
> Would that make a difference?
>
>
> On Thu, Dec 11, 2014 at 10:24 AM, david <da...@free.fr> wrote:
>>
>> Hi,
>>
>>   We use the following Spark Streaming code to collect and process Kafka
>> event :
>>
>>     kafkaStream.foreachRDD(rdd => {
>>       rdd.collect().foreach(event => {
>>           process(event._1, event._2)
>>       })
>>     })
>>
>> This work fine.
>>
>> But without /collect()/ function, the following exception is raised for
>> call
>> to function process:
>>     *Loss was due to java.lang.ExceptionInInitializerError*
>>
>>
>>   We attempt to rewrite like this but the same exception is raised :
>>
>>      kafkaStream.foreachRDD(rdd => {
>>       rdd.foreachPartition(iter =>
>>         iter.foreach (event => {
>>         process(event._1, event._2)
>>       })
>>       )
>>     })
>>
>>
>> Does anybody can explain to us why and how to solve this issue ?
>>
>> Thank's
>>
>> Regards
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-spark-user-list.1001560.n3.nabble.com/Spark-steaming-work-with-collect-but-not-without-collect-tp20622.html
>> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
>> For additional commands, e-mail: user-help@spark.apache.org
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Re: Spark steaming : work with collect() but not without collect()

Posted by Gerard Maas <ge...@gmail.com>.
Have you tried with  kafkaStream.foreachRDD(rdd => {rdd.foreach(...)} ?
Would that make a difference?


On Thu, Dec 11, 2014 at 10:24 AM, david <da...@free.fr> wrote:

> Hi,
>
>   We use the following Spark Streaming code to collect and process Kafka
> event :
>
>     kafkaStream.foreachRDD(rdd => {
>       rdd.collect().foreach(event => {
>           process(event._1, event._2)
>       })
>     })
>
> This work fine.
>
> But without /collect()/ function, the following exception is raised for
> call
> to function process:
>     *Loss was due to java.lang.ExceptionInInitializerError*
>
>
>   We attempt to rewrite like this but the same exception is raised :
>
>      kafkaStream.foreachRDD(rdd => {
>       rdd.foreachPartition(iter =>
>         iter.foreach (event => {
>         process(event._1, event._2)
>       })
>       )
>     })
>
>
> Does anybody can explain to us why and how to solve this issue ?
>
> Thank's
>
> Regards
>
>
>
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/Spark-steaming-work-with-collect-but-not-without-collect-tp20622.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
>
>