(Solved) spark-submit error Exception in thread “main” java.sql.SQLException: No suitable driver found

question

Executing spark-submit on linux reports an error that the driver cannot be found, but I can run it on the local idea, excluding code problems, it may be that linux does not place the mysql driver jar package
insert image description here

Solution

  1. Find JAVA_HOME first
which java

insert image description here

  1. enter ext
cd ~/jdk1.8.0_171/jre/lib/ext
  1. Place the mysql driver jar package in this folder
    insert image description here
  2. Re-run
    insert image description here

Guess you like

Origin blog.csdn.net/weixin_54218079/article/details/127733604