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.

piggybank compilation

Highlighted

piggybank compilation

Expert Contributor

Hi,

I need to change the code which is part of the Piggybank and i need to compile my own piggybank.jar.... is it possible inside sanbox?

I went step by step by https://cwiki.apache.org/confluence/display/PIG/P... ... but it doesnt work at all.

[root@sandbox trunk]# pwd
/root/pig/trunk
[root@sandbox trunk]# export CLASSPATH=$CLASSPATH:/usr/hdp/2.3.2.0-2950/hadoop/client/hadoop-mapreduce-client-core.jar:/usr/hdp/2.3.2.0-2950/hadoop-mapreduce/hadoop-ant.jar:/usr/hdp/2.3.2.0-2950/pig/pig-0.15.0.2.3.2.0-2950-core-h2.jar
[root@sandbox trunk]# ant
/usr/share/java-utils/java-functions: line 15: .: /etc/java/java.conf: cannot execute binary file
/usr/share/java-utils/java-functions: line 15: .: /etc/java/java.conf: cannot execute binary file
/usr/bin/build-classpath: error: JAVA_LIBDIR must be set
Error: Could not find or load main class org.apache.tools.ant.launch.Launcher

thanks

5 REPLIES 5
Highlighted

Re: piggybank compilation

Expert Contributor

which files do you mean?

[root@sandbox trunk]# ls -al /etc/java/java.conf -rwxr-xr-x 1 root root 684 2015-07-23 17:46 /etc/java/java.conf

Highlighted

Re: piggybank compilation

Expert Contributor
error: JAVA_LIBDIR must be set

The CLASSPATH is empty, etc... i think it requires more setup.

Highlighted

Re: piggybank compilation

Expert Contributor

I executed commands below, still with no success.

export JAVA_HOME="/usr/lib/jvm/java/";

export ANT_HOME="/usr/share/ant";

[root@sandbox trunk]# ant -v
Apache Ant version 1.7.1 compiled on August 24 2010
Buildfile: build.xml
Detected Java version: 1.6 in: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91.x86_64/jre
Detected OS: Linux
parsing buildfile /root/pig/trunk/build.xml with URI = file:/root/pig/trunk/build.xml
Project base dir set to: /root/pig/trunk
[antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.
 [property] Loading /root/build.properties
 [property] Unable to find property file: /root/build.properties
 [property] Loading /root/pig/trunk/build.properties
 [property] Unable to find property file: /root/pig/trunk/build.properties
Property "exectype" has not been set
 [property] Loading Environment env.
Property "clover.home" has not been set
[available] Unable to find ${clover.home}/lib/clover.jar to set property clover.present
Property "repo" has not been set
Property "hbase.hadoop.version" has not been set
Override ignored for property "build.dir"
[available] Unable to find build/lib/ant-eclipse-1.0-jvm1.2.jar
Property "zookeeper.jarfile" has not been set
 [macrodef] creating macro  svnversion
 [macrodef] creating macro  compileSources

BUILD FAILED
/root/pig/trunk/build.xml:780: Problem: failed to create task or type scriptdef
Cause: the class org.apache.tools.ant.taskdefs.optional.script.ScriptDef was not found.
        This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
        -/usr/share/ant/lib
        -/root/.ant/lib
        -a directory added on the command line with the -lib argument

Do not panic, this is a common problem.
The commonest cause is a missing JAR.

This is not a bug; it is a configuration problem

        at org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownElement.java:484)
        at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:416)
        at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:160)
        at org.apache.tools.ant.Task.perform(Task.java:347)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:142)
        at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:93)
        at org.apache.tools.ant.Main.runBuild(Main.java:743)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Total time: 0 seconds

Highlighted

Re: piggybank compilation

Expert Contributor
cat /etc/java/java.conf



# System-wide Java configuration file                                -*- sh -*-
#
# JPackage Project

# Location of jar files on the system
JAVA_LIBDIR=/usr/share/java

# Location of arch-specific jar files on the system
JNI_LIBDIR=/usr/lib/java

# Root of all JVM installations
JVM_ROOT=/usr/lib/jvm

# You can define a system-wide JVM root here if you're not using the default one
#JAVA_HOME=$JVM_ROOT/java

# Options to pass to the java interpreter
JAVACMD_OPTS=

Highlighted

Re: piggybank compilation

Mentor

@John Smith are you still having issues with this? Can you accept best answer or provide your own solution?

Don't have an account?
Coming from Hortonworks? Activate your account here