---
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/kunpengboostkithistory/2200/bds/kunpengbdssparkml_16_0042.html
sourcePath: /source/zh/kunpengboostkithistory/2200/bds/kunpengbdssparkml_16_0042.html
indexId: 1a70cde25773736f4e297102d984e9c41fc568d9171ef4cb504f8e4b56ef9fff73
---
# 在使用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”配置。
