Apache Airflow JDBC Hook无法找到驱动程序类

时间:2018-09-14 13:47:47

标签: airflow

我想通过jdbc将Airflow连接到Db,但遇到一个问题,它说找不到驱动程序类。我从以下页面下载连接器到mysql:https://dev.mysql.com/downloads/connector/j/,然后将jar放在目录中。我用正确的jdbc url和连接器路径创建了新连接。我指出了驱动程序类名称为com.mysql.cj.jdbc.Driver,但是每次我的任务运行时,我都会收到RuntimeException,它找不到该类。我该怎么办 ?

[2018-09-14 13:40:24,541] {base_task_runner.py:98} INFO - Subtask: [2018-09-14 13:40:24,541] {base_hook.py:80} INFO - Using connection to: jdbc:mysql://dev.*************************.amazonaws.com
[2018-09-14 13:40:24,833] {base_task_runner.py:98} INFO - Subtask: Traceback (most recent call last):
[2018-09-14 13:40:24,834] {base_task_runner.py:98} INFO - Subtask:   File "/usr/bin/airflow", line 27, in <module>
[2018-09-14 13:40:24,834] {base_task_runner.py:98} INFO - Subtask:     args.func(args)
[2018-09-14 13:40:24,835] {base_task_runner.py:98} INFO - Subtask:   File "/usr/lib/python2.7/site-packages/airflow/bin/cli.py", line 392, in run
[2018-09-14 13:40:24,835] {base_task_runner.py:98} INFO - Subtask:     pool=args.pool,
[2018-09-14 13:40:24,836] {base_task_runner.py:98} INFO - Subtask:   File "/usr/lib/python2.7/site-packages/airflow/utils/db.py", line 50, in wrapper
[2018-09-14 13:40:24,836] {base_task_runner.py:98} INFO - Subtask:     result = func(*args, **kwargs)
[2018-09-14 13:40:24,836] {base_task_runner.py:98} INFO - Subtask:   File "/usr/lib/python2.7/site-packages/airflow/models.py", line 1493, in _run_raw_task
[2018-09-14 13:40:24,837] {base_task_runner.py:98} INFO - Subtask:     result = task_copy.execute(context=context)
[2018-09-14 13:40:24,837] {base_task_runner.py:98} INFO - Subtask:   File "/home/airflow_devtest/plugins/data_wizards_plugin/operators/data_availability_operator.py", line 66, in execute
[2018-09-14 13:40:24,838] {base_task_runner.py:98} INFO - Subtask:     result = hook.get_records(sql=self.sql, parameters=self.parameters)
[2018-09-14 13:40:24,838] {base_task_runner.py:98} INFO - Subtask:   File "/usr/lib/python2.7/site-packages/airflow/hooks/dbapi_hook.py", line 106, in get_records
[2018-09-14 13:40:24,842] {base_task_runner.py:98} INFO - Subtask:     with closing(self.get_conn()) as conn:
[2018-09-14 13:40:24,843] {base_task_runner.py:98} INFO - Subtask:   File "/usr/lib/python2.7/site-packages/airflow/hooks/jdbc_hook.py", line 58, in get_conn
[2018-09-14 13:40:24,843] {base_task_runner.py:98} INFO - Subtask:     jars=jdbc_driver_loc.split(","))
[2018-09-14 13:40:24,843] {base_task_runner.py:98} INFO - Subtask:   File "/usr/lib64/python2.7/site-packages/jaydebeapi/__init__.py", line 381, in connect
[2018-09-14 13:40:24,844] {base_task_runner.py:98} INFO - Subtask:     jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
[2018-09-14 13:40:24,844] {base_task_runner.py:98} INFO - Subtask:   File "/usr/lib64/python2.7/site-packages/jaydebeapi/__init__.py", line 190, in _jdbc_connect_jpype
[2018-09-14 13:40:24,844] {base_task_runner.py:98} INFO - Subtask:     jpype.JClass(jclassname)
[2018-09-14 13:40:24,845] {base_task_runner.py:98} INFO - Subtask:   File "/usr/lib64/python2.7/site-packages/jpype/_jclass.py", line 73, in JClass
[2018-09-14 13:40:24,845] {base_task_runner.py:98} INFO - Subtask:     raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name)
[2018-09-14 13:40:24,845] {base_task_runner.py:98} INFO - Subtask: jpype._jexception.RuntimeExceptionPyRaisable: java.lang.RuntimeException: Class com.mysql.cj.jdbc.Driver not found

0 个答案:

没有答案