PIG.Jar not getting created when building it



0
I am not seeing PIG.jar getting created after build of trunk folder as per PIG documentation to run UDFs, instead I ma seeing "pig-0.16.0-SNAPSHOT-core-h1.jar", under trunk folder.

As per below PIG doc it shud create pig.jar:

======================================
https://pig.apache.org/docs/r0.11.1/udf.html#udf-java

Now that we have the function implemented, it needs to be compiled and included in a jar. You will need to build pig.jar to compile your UDF. You can use the following set of commands to checkout the code from SVN repository and create pig.jar:

svn co http://svn.apache.org/repos/asf/pig/trunk
cd trunk
ant

You should see pig.jar in your current working directory. The set of commands below first compiles the function and then creates a jar file that contains it.

cd myudfs
javac -cp pig.jar UPPER.java
cd ..
jar -cf myudfs.jar myudfs

You should now see myudfs.jar in your current working directory. You can use this jar with the script described in the previous section.
==========================


I used "pig-0.16.0-SNAPSHOT-core-h1.jar" instead of pig.jar and used above commnads.
I created myudfs folder under "/home/hadoop" and put the my udf java files uder it and ran below command & getting this error:

=================================
hadoop@hadoop:~/myudfs$ javac -cp /home/hadoop/trunk/pig-0.16.0-SNAPSHOT-core-h1.jar /home/hadoop/myudfs/Upper1.java
/home/hadoop/myudfs/Upper1.java:10: error: cannot access WritableComparable
if (input == null || input.size() == 0 || input.get(0) == null)
^
class file for org.apache.hadoop.io.WritableComparable not found
1 error
hadoop@hadoop:~/myudfs$
==========================

I am not sure if issue is at first place where pig.jar itself is not creating but snapshot jar is getting created and that's why compile is failing or if it is some other issue??



1 Answer(s)


0

Hi Surender,

The error shows that the class WritableComparable not found at the given package location - org.apache.hadoop.io.
Please open the jar or import the jar into eclipse and check whether package is same or not. If same please check this class is available in the jar.

Your Answer

Click on this code-snippet-icon icon to add code snippet.

Upload Files (Maximum image file size - 1.5 MB, other file size - 10 MB, total size - not more than 50 MB)

Email
Password