我已经用下面的代码创建了执行sqoop-1.4.5的java程序
String cmd = "import --connect \"jdbc:mysql://ip:3306/test\" --username root --password root --table seekay --target-dir /seekay -m 1";
Sqoop.runTool(cmd.split(" "));
当我运行程序将表从mysql数据库导入hdfs时,我遇到了以下异常
2016-03-23 15:49:56,260 INFO [Timer-Driven Process Thread-2] org.apache.sqoop.Sqoop Running Sqoop version: 1.4.5
2016-03-23 15:49:56,296 WARN [Timer-Driven Process Thread-2] org.apache.sqoop.tool.BaseSqoopTool Setting your password on the command-line is insecure. Consider using -P instead.
2016-03-23 15:49:56,332 WARN [Timer-Driven Process Thread-2] org.apache.sqoop.ConnFactory $SQOOP_CONF_DIR has not been set in the environment. Cannot check for additional configuration.
2016-03-23 15:49:56,649 ERROR [Timer-Driven Process Thread-2] o.a.sqoop.manager.oracle.OraOopUtilities Unable to determine whether debug logging should be enabled.
java.lang.NullPointerException
at org.apache.sqoop.manager.oracle.OraOopUtilities.enableDebugLoggingIfRequired(OraOopUtilities.java:239)
at org.apache.sqoop.manager.oracle.OraOopManagerFactory.accept(OraOopManagerFactory.java:69)
at org.apache.sqoop.ConnFactory.getManager(ConnFactory.java:184)
at org.apache.sqoop.tool.BaseSqoopTool.init(BaseSqoopTool.java:247)
at org.apache.sqoop.tool.ImportTool.init(ImportTool.java:89)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:589)
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)
我已经在classpath中添加了所有依赖jar文件。帮我解决这个问题。
谢谢
1条答案
按热度按时间jgovgodb1#
我也有同样的问题。经过一步一步的调试,我发现是log4j依赖问题。
我的解决方案是将log4j-over-slf4j从springframework中排除: