涉及Spark + Scala组合错误的非法循环引用

时间:2017-04-09 12:00:47

标签: scala apache-spark cassandra datastax-enterprise datastax-enterprise-graph

我正面临 涉及 错误的非法循环引用与Spark + Scala合并。

Error Ocured during job for '1473170880000000' and Error Message is scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving method srcip
    at scala.reflect.internal.Symbols$Symbol$$anonfun$info$3.apply(Symbols.scala:1220)
    at scala.reflect.internal.Symbols$Symbol$$anonfun$info$3.apply(Symbols.scala:1218)
    at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.reflect.internal.Symbols$Symbol.lock(Symbols.scala:482)
    at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1218)
    at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1374)
    at scala.reflect.internal.Symbols$Symbol.privateWithin(Symbols.scala:1169)
    at scala.reflect.internal.Symbols$Symbol.hasAccessBoundary(Symbols.scala:1176)
    at scala.reflect.internal.HasFlags$class.isPublic(HasFlags.scala:111)
    at scala.reflect.internal.Symbols$Symbol.isPublic(Symbols.scala:112)
    at com.datastax.spark.connector.util.ReflectionUtil$$anonfun$2.apply(ReflectionUtil.scala:77)

Error Ocured during job for '1453743420000000' and Error Message is scala.MatchError: <error> (of class scala.reflect.internal.Types$ErrorType$)
    at com.datastax.spark.connector.util.ReflectionUtil$.returnType(ReflectionUtil.scala:113)

当我尝试同时执行多个作业时会发生此错误。它闻起来像多线程问题。不是吗?从Cassandra加载数据时(执行我的第一个操作时)或将数据保存到Cassandra rdd.saveToCassandra(...)

时会出现此错误

我的依赖详情

    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-core_2.10</artifactId>
        <version>1.6.2</version>
    </dependency>

    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-sql_2.10</artifactId>
        <version>1.6.2</version>
    </dependency>

    <dependency>
        <groupId>com.datastax.spark</groupId>
        <artifactId>spark-cassandra-connector_2.10</artifactId>
        <version>1.6.0</version>
    </dependency>

    <dependency>
        <groupId>com.datastax.cassandra</groupId>
        <artifactId>dse-driver</artifactId>
        <version>1.1.0</version>
    </dependency>

    <dependency>
        <groupId>com.datastax.cassandra</groupId>
        <artifactId>cassandra-driver-core</artifactId>
        <version>3.0.2</version>
    </dependency>

驱动程序错误日志enter image description here

对此有任何建议/帮助表示高度赞赏。谁有人遇到过这个问题?

1 个答案:

答案 0 :(得分:1)

最后问题解决了。我的应用程序和spark二进制文件是基于Scala 2.10构建的。似乎Scala 2.10有反射/多线程问题,它在我经历的一些论坛上发布作为建议。

修复方法是,我使用Scala 2.11构建了我的应用程序,并使用了基于2.11构建的Spark库。问题消失了。

更新了相关性

        org.apache.spark         火花core_2.11         1.6.2     

<dependency>
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-sql_2.11</artifactId>
    <version>1.6.2</version>
</dependency>

<dependency>
    <groupId>com.datastax.spark</groupId>
    <artifactId>spark-cassandra-connector_2.11</artifactId>
    <version>1.6.0</version>
</dependency>

希望这会对某人有所帮助。