ERROR exec.DDLTask: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.xxx

问题:
通过sqoop工具将mysql中的数据导入到hive中

sqoop import --connect jdbc:mysql://master:3306/mf --username root --password xxxx --table t_activity_page --split-by id --delete-target-dir --hive-import -m 1

报如下错误:

ERROR exec.DDLTask: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectMapper.readerFor(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/ObjectReader;
	at org.apache.hadoop.hive.common.StatsSetupConst$ColumnStatsAccurate.(StatsSetupConst.java:165)
	at org.apache.hadoop.hive.common.StatsSetupConst.parseStatsAcc(StatsSetupConst.java:297)
	at org.apache.hadoop.hive.common.StatsSetupConst.setBasicStatsState(StatsSetupConst.java:230)
	at org.apache.hadoop.hive.common.StatsSetupConst.setBasicStatsStateForCreateTable(StatsSetupConst.java:292)
	at org.apache.hadoop.hive.ql.plan.CreateTableDesc.toTable(CreateTableDesc.java:839)
	at org.apache.hadoop.hive.ql.exec.DDLTask.createTable(DDLTask.java:4321)
	at org.apache.hadoop.hive.ql.exec.DDLTask.execute(DDLTask.java:354)
	at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:199)
	at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:100)
	at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:2183)
	at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1839)
	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1526)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1237)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1227)

原因
sqoop与hive使用的jackson包的版本冲突导致
解决办法
将hive的lib目录下的jackson相关jar包拷贝到sqoop的lib目录下

  1. 先备份好sqoop lib目录下的所有jackson jar包
  2. 将hive lib下的jackson jar包拷贝到sqoop lib目录下。
cp $HIVE_HOME/lib/jackson*.jar $SQOOP_HOME/lib/

你可能感兴趣的:(问题解决整理)