---
title: 在使用spark-submit的方式提交算法任务时报错
description: "在使用spark-submit的方式提交随机森林、决策树、GBDT算法任务时，配置“spark.driver.userClassPathFirst=true”或“spark.executor.userClassPathFirst=true”，会导致算法异常终止，并报ClassCastException异常或loader constraint violation错误。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengbds/appAccelFeatures/algorithmaccelf_ml/kunpengbdssparkml_16_0042.html
sourcePath: /source/zh/kunpengbds/appAccelFeatures/algorithmaccelf_ml/kunpengbdssparkml_16_0042.html
indexId: 4f1ba59a299be2efbf23e934c743db7b5cd56c00e9d6559634ceb3ea0f9e7b5588
---
# 在使用spark-submit的方式提交算法任务时报错

#### 问题现象描述

在使用spark-submit的方式提交随机森林、决策树、GBDT算法任务时，配置“spark.driver.userClassPathFirst=true”或“spark.executor.userClassPathFirst=true”，会导致算法异常终止，并报ClassCastException异常或loader constraint violation错误。


#### 关键过程、根本原因分析

这两个参数为实验参数，会改变Spark任务JAR包的加载顺序，导致类冲突。


#### 结论、解决方案及效果

在spark-submit提交任务时，去掉“spark.driver.userClassPathFirst=true”或“spark.executor.userClassPathFirst=true”配置。
