Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

hadoop

sqoop

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
/usr/lib/jvm/jdk1.7.0_15

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
export PATH=$PATH:$SQOOP_HOME/bin

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

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

like image 291
Diddy Avatar asked Feb 17 '23 18:02

Diddy


1 Answers

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.

like image 154
Mark Vickery Avatar answered Feb 19 '23 10:02

Mark Vickery