首页 > 代码库 > 解决Sqoop报错Could not load db driver class: com.intersys.jdbc.CacheDriver

解决Sqoop报错Could not load db driver class: com.intersys.jdbc.CacheDriver

报错栈:

17/06/16 17:46:01 INFO tool.CodeGenTool: Beginning code generation17/06/16 17:46:01 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: Could not load db driver class: com.intersys.jdbc.CacheDriverjava.lang.RuntimeException: Could not load db driver class: com.intersys.jdbc.CacheDriver        at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:856)        at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)        at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:744)        at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:767)        at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:270)        at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:241)        at org.apache.sqoop.manager.SqlManager.getColumnTypesForQuery(SqlManager.java:234)        at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:304)        at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1870)        at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1682)        at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:107)        at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478)        at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:605)        at org.apache.sqoop.Sqoop.run(Sqoop.java:143)        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)        at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)        at org.apache.sqoop.Sqoop.main(Sqoop.java:236)

原因:执行导入的MR任务时找不到数据库连接的驱动包,只需把CacheDB.jar放到$SQOOP_HOME/lib下即可,sqoop提交MR任务时会自动把这个目录下的所有Jar包放入MR Job的Classpath中

解决Sqoop报错Could not load db driver class: com.intersys.jdbc.CacheDriver