Diddy Diddy - 1 year ago 482
Java Question

It seems as though you are running sqoop with a JRE - But JAVA_HOME set to JDK

I tried to set up sqoop (sqoop-1.4.3.bin__hadoop-1.0.0) on Ubuntu. I can run the basic sqoop help etc without problems. When I run the following I get an error:

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)

I googled to find an answer to this error and most answer point to setting JAVA_HOME to your JDK, which I have (in ~/.bashrc [on Ubuntu]).

$ echo $JAVA_HOME

These are the other variables I set:

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

I also added the mysql jdbc driver to the lib folder.

Any ideas why I get this error?
Thanks in advance,

Answer Source

Scoop creates java classes that represent the schema of the table you are importing in. So to create the classes you need the jdk instead of the jre.

Set the JAVA_HOME in the ./bashrc and the $HADOOP_HOME/conf/hadoop-env.sh as well.

That should work.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download