xgboost4j-spark在加载类文件时检测到缺失或无效的依赖关系' XGBoost.class'

时间:2018-06-19 06:29:08

标签: apache-spark xgboost

我使用xgboost和spark

scala版本:2.11.8

java版本:1.7

spark版本:2.1.0

maven依赖项:

 <dependencies>
    <!-- https://mvnrepository.com/artifact/ml.dmlc/xgboost4j-spark -->
    <dependency>
        <groupId>ml.dmlc</groupId>
        <artifactId>xgboost4j-spark</artifactId>
        <version>0.8</version>
    </dependency>


    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-core_2.11</artifactId>
        <version>${spark.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-mllib_2.11</artifactId>
        <version>${spark.version}</version>
        <scope>provided</scope>
    </dependency>

</dependencies>

我使用的想法,当我编写代码时,没有错误,但是当我想将我的项目打包到jar时,它会显示错误。

1 个答案:

答案 0 :(得分:1)

原因是缺少xgboost4j依赖,只需添加maven:

<dependency>
        <groupId>ml.dmlc</groupId>
        <artifactId>xgboost4j</artifactId>
        <version>0.8</version>
</dependency>