2

I'm trying to run an Apache Hive web interface, so I downloaded the lastest version of ant (Ant 1.9.4), and when I execute the command to produce the hive.war file

 ANT_LIB=/opt/ant/lib bin/hive --service hwi

I get the following error:

 cp=/tmp/Jetty_0_0_0_0_9999_hive.hwi.0.10.0.war__hwi__ae9cmk/jsp
    cp=null
    work dir=/tmp/Jetty_0_0_0_0_9999_hive.hwi.0.10.0.war__hwi__ae9cmk/jsp
    extension dir=/usr/lib/jvm/jdk1.7.0_65/jre/lib/ext:/usr/java/packages/lib/ext
    srcDir=/tmp/Jetty_0_0_0_0_9999_hive.hwi.0.10.0.war__hwi__ae9cmk/jsp
   compilerTargetVM=1.5
   compilerSourceVM=1.5
    include=org/apache/jsp/index_jsp.java

15/02/23 09:56:59 ERROR compiler.Compiler: Error compiling file: /tmp/Jetty_0_0_0_0_9999_hive.hwi.0.10.0.war__hwi__ae9cmk/jsp//org/apache/jsp/index_jsp.java     [javac] warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds


15/02/23 09:56:59 ERROR mortbay.log: /hwi/
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/jdk1.7.0_65/jre"
    at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:130)
    at org.apache.tools.ant.taskdefs.Javac.findSupportedFileExtensions(Javac.java:984)
    at org.apache.tools.ant.taskdefs.Javac.scanDir(Javac.java:961)
    at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:932)
    at org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:220)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)

I'm executing that code as root. My JAVA_HOME is correctly set at the .bashrc:

export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_65
export HADOOP_LIBEXEC_DIR=/usr/lib/hadoop/libexec
export HADOOP_CONF_DIR=/etc/hadoop/conf

export PATH=$PATH:$JAVA_HOME/bin

and .bash_profile files:

.bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_65
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin

export PATH

I want to know why is Ant referencing the javac at "/usr/lib/jvm/jdk1.7.0_65/jre". Moreover, here is my JDK structure:

[root@ip-10-32-205-19 ~]# cd $JAVA_HOME
[root@ip-10-32-205-19 jdk1.7.0_65]# ls -l
total 19760
drwxr-xr-x. 2 root root     4096 Feb 23 04:09 bin
-r--r--r--. 1 root root     3339 Jun 17  2014 COPYRIGHT
drwxr-xr-x. 4 root root     4096 Jun 17  2014 db
drwxr-xr-x. 3 root root     4096 Jun 17  2014 include
drwxr-xr-x. 5 root root     4096 Jun 17  2014 jre
drwxr-xr-x. 5 root root     4096 Feb 23 04:09 lib
-r--r--r--. 1 root root       40 Jun 17  2014 LICENSE
drwxr-xr-x. 4 root root     4096 Jun 17  2014 man
-r--r--r--. 1 root root      114 Jun 17  2014 README.html
-rw-r--r--. 1 root root      499 Jun 17  2014 release
-rw-r--r--. 1 root root 19902785 Jun 17  2014 src.zip
-rw-r--r--. 1 root root   110114 Jun 16  2014 THIRDPARTYLICENSEREADME-JAVAFX.txt
-r--r--r--. 1 root root   173559 Jun 17  2014 THIRDPARTYLICENSEREADME.txt

which shows I have the JDK, and not only the JRE installed. I also took a look at similar questions, but none could solve my problem. The Java is 64bits, plus I also ran source for both .bashrc and .bash_profile.

cybertextron
  • 10,547
  • 28
  • 104
  • 208

1 Answers1

0

The error message says:

Perhaps JAVA_HOME does not point to the JDK. It is currently set to "/usr/lib/jvm/jdk1.7.0_65/jre"

However, your .bashrc has:

export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_65

You likely need to run source ~/.bashrc in your Bash shell to reset JAVA_HOME to the root of your JDK installation. Then run Ant again.

Chad Nouis
  • 6,861
  • 1
  • 27
  • 28
  • I see references to Jetty in the error messages. Can you restart the Jetty web server? Does the Jetty server run under the root account as well? – Chad Nouis Feb 23 '15 at 15:43
  • All I try to do is to execute the following command: `ANT_LIB=/opt/ant/lib bin/hive --service hwi`. I'm following this tutorial: https://cwiki.apache.org/confluence/display/Hive/HiveWebInterface . I execute everything as root, and that command will produce a `hive.war` file plus deploy the server using jetty. I'm also not very familiar with `jetty` itself – cybertextron Feb 23 '15 at 15:48
  • Take a look at [hadoop ERROR : JAVA_HOME is not set](http://stackoverflow.com/questions/8827102/hadoop-error-java-home-is-not-set). Make sure JAVA_HOME in hadoop-env.sh is *uncommented* and set to: /usr/lib/jvm/jdk1.7.0_65 – Chad Nouis Feb 23 '15 at 16:05
  • That's already done: `export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_65` – cybertextron Feb 23 '15 at 16:16