我尝试在 Ubuntu 上设置 sqoop (sqoop-1.4.3.bin__hadoop-1.0.0)。我可以毫无问题地运行基本的 sqoop 帮助等。当我运行以下命令时,出现错误:
sqoop import --connect jdbc:mysql://localhost/test --table sales -m 1
13/04/19 10:35:24 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /opt/hadoop/hadoop-1.0.4
13/04/19 10:35:24 ERROR orm.CompilationManager: It seems as though you are running sqoop with a JRE.
13/04/19 10:35:24 ERROR orm.CompilationManager: Sqoop requires a JDK that can compile Java code.
13/04/19 10:35:24 ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.
13/04/19 10:35:24 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: Could not start Java compiler.
at org.apache.sqoop.orm.CompilationManager.compile(CompilationManager.java:176)
我用谷歌搜索了这个错误的答案,大多数答案都指向将 JAVA_HOME 设置为我拥有的 JDK(在 ~/.bashrc [在 Ubuntu 上])。
$ echo $JAVA_HOME
/usr/lib/jvm/jdk1.7.0_15
这些是我设置的其他变量:
export HADOOP_COMMON_HOME=/opt/hadoop/hadoop-1.0.4
export HADOOP_MAPRED_HOME=/opt/hadoop/hadoop-1.0.4
export SQOOP_HOME=/opt/hadoop/sqoop-1.4.3.bin__hadoop-1.0.0
export PATH=$PATH:$SQOOP_HOME/bin
我还将 mysql jdbc 驱动程序添加到 lib 文件夹中。
任何想法为什么我会收到此错误?在此先感谢,老爹