Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.

ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.

Explorer

Hi 

 

I have installed sqoop version 1.4.5-cdh5.4.2 and mysql-connector-java.jar version mysql-connector-java-5.1.31.jar in /usr/lib/sqoop/lib

 

I am getting the following error. Please help me with the error. 

 

15/05/26 01:41:03 ERROR orm.CompilationManager: It seems as though you are running sqoop with a JRE.
15/05/26 01:41:03 ERROR orm.CompilationManager: Sqoop requires a JDK that can compile Java code.
15/05/26 01:41:03 ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.
15/05/26 01:41:03 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:187)
at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:97)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:605)
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)
at org.apache.sqoop.Sqoop.main(Sqoop.java:236)

 

I appreciate your help. 

 

Thank you, 

 

 

12 REPLIES 12

Re: ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.

Master Guru
Do you have only a JRE installed, or the full JDK? Sqoop's code-gen
requires a working 'javac' on PATH, or the JAVA_HOME pointed to a JDK
that includes the Java compiler.

Re: ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.

Explorer

Hi Harsh,

 

I have my cluster on Amazon ec2 machines (Amazon Linux AMI 2015.03 (HVM)).

 

[ec2-user@ip-172-31-6-10 ~]$ java -version
java version "1.7.0_79"
OpenJDK Runtime Environment (amzn-2.5.5.1.59.amzn1-x86_64 u79-b14)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
 

I have set the java path in ~/.bashrc file, /etc/default/hadoop, /etc/sqoop/conf/sqoop-env-template.sh like 

 

export JAVA_HOME=/usr
export PATH=$JAVA_HOME/bin:$PATH

 

I can list the databases and tables connecting to sqoop, but I am getting the error while importing it. 

 

sqoop --list-databases --connect jdbc:mysql://localhost/ --username training --password training

 

Please let me know does this information helps you to resolve the problem.

 

Thank you for timely response.

 

Bye.

Re: ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.

Rising Star

Hi Losetty,

 

Have you pointed out the exact version of JDK by using alternatives ? Could you try to point out the exact and high priority JDK version by using alternatives command. If it is the tar ball installation of JDK we point out the exact path instead of /usr.

 

Thanks,

Sathish

Thanks,
Sathish (Satz)

Re: ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.

Explorer

Hi 

 

I have set the exact path of Java now. Still I am getting the same old error.

 

[ec2-user@ip-172-31-6-10 ~]$ echo $JAVA_HOME
/usr/lib/jvm/jre-1.7.0-openjdk.x86_64

 

15/05/26 16:59:59 INFO sqoop.Sqoop: Running Sqoop version: 1.4.5-cdh5.4.2
15/05/26 16:59:59 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
15/05/26 17:00:00 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
15/05/26 17:00:00 INFO tool.CodeGenTool: Beginning code generation
15/05/26 17:00:01 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `employee` AS t LIMIT 1
15/05/26 17:00:01 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `employee` AS t LIMIT 1
15/05/26 17:00:01 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/lib/hadoop-mapreduce
15/05/26 17:00:01 ERROR orm.CompilationManager: It seems as though you are running sqoop with a JRE.
15/05/26 17:00:01 ERROR orm.CompilationManager: Sqoop requires a JDK that can compile Java code.
15/05/26 17:00:01 ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.
15/05/26 17:00:01 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:187)
at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:97)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:605)
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)
at org.apache.sqoop.Sqoop.main(Sqoop.java:236)

Re: ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.

New Contributor

Hi,

 

I am also gettting the same error, How did you get this resolved? 

 

I have set following in ~/.bashrac and sourced it:

 

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64/
export PATH=$PATH:$JAVA_HOME/bin

 

Also set above in $HADOOP_HOME/conf/hadoop-env.sh and in /usr/lib/sqoop/conf/sqoop-env.sh

 

Please help.

Complete Error:

 

 

> sqoop import-all-tables -m 12 --connect jdbc:mysql://localhost:3306/accrual_restored --username=root --compression-codec=snappy --as-avrodatafile --warehouse-dir=.


Warning: /usr/lib/sqoop/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /usr/lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.

15/08/13 21:12:39 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6

15/08/13 21:12:39 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]

15/08/13 21:12:40 INFO tool.CodeGenTool: Beginning code generation
15/08/13 21:12:40 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `accrual_items` AS t LIMIT 1
15/08/13 21:12:40 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `accrual_items` AS t LIMIT 1
15/08/13 21:12:40 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/local/hadoop
15/08/13 21:12:40 ERROR orm.CompilationManager: It seems as though you are running sqoop with a JRE.
15/08/13 21:12:40 ERROR orm.CompilationManager: Sqoop requires a JDK that can compile Java code.
15/08/13 21:12:40 ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.
15/08/13 21:12:40 ERROR tool.ImportAllTablesTool: Encountered IOException running import job: java.io.IOException: Could not start Java compiler.

Re: ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.

Master Guru
Are you sure you have a JDK and not just the JRE installed? As it states,
Sqoop will try to compile some generated sources.

What does the "javac -version" command output?

Also, please note that OpenJDK is not tested on by us and we recommend use
of Oracle's JDKs.

Re: ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.

New Contributor

Hi Harsh,

 

Thanks for your quick reply.

 

I am still getting this error. Now I have set JAVA_HOME to:

 

> echo $JAVA_HOME
/usr/lib/jvm/jdk1.7.0_79/

 

> javac -version
javac 1.7.0_79 

 

> ls -lah /etc/alternatives/java
lrwxrwxrwx 1 root root 37 Aug 14 15:23 /etc/alternatives/java -> /usr/lib/jvm/jdk1.7.0_79/jre/bin/java

 

> ls -lah /etc/alternatives/javac
lrwxrwxrwx 1 root root 34 Aug 14 15:23 /etc/alternatives/javac -> /usr/lib/jvm/jdk1.7.0_79/bin/javac

 

But same error:

 

> sqoop import-all-tables -m 12 --connect jdbc:mysql://localhost:3306/accrual_restored --username=root --compression-codec=snappy --as-avrodatafile --warehouse-dir=/home/saurabh.mimani/
Warning: /hcatalog/ does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /usr/lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
15/08/14 15:23:50 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6
15/08/14 15:23:50 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
15/08/14 15:23:50 INFO tool.CodeGenTool: Beginning code generation
15/08/14 15:23:50 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `accrual_items` AS t LIMIT 1
15/08/14 15:23:50 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `accrual_items` AS t LIMIT 1
15/08/14 15:23:51 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/local/hadoop
15/08/14 15:23:51 ERROR orm.CompilationManager: It seems as though you are running sqoop with a JRE.
15/08/14 15:23:51 ERROR orm.CompilationManager: Sqoop requires a JDK that can compile Java code.
15/08/14 15:23:51 ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.
15/08/14 15:23:51 ERROR tool.ImportAllTablesTool: Encountered IOException running import job: java.io.IOException: Could not start Java compiler.

Highlighted

Re: ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.

Master Guru
Did you also remove the other JVM from the machine? If not, try declaring
export JAVA_HOME inside /etc/hadoop/conf/hadoop-env.sh and then retry.

It is likely that your Sqoop may still be picking up an older JVM, based on
the "bigtop-detect-java" results that it relies on.

Re: ERROR orm.CompilationManager: Please install a JDK and set $JAVA_HOME to use it.

New Contributor
yes, This worked. Thanks a lot.