2
votes

I have a Pig script that returns a constant string value. When I try to run the script with the following command, I get a Pig ERROR 2998:

pig -Dpig.additional.jars=Static.jar -f script.pig -l /dev/null -x local

script.pig

loaded = LOAD 'data/' USING com.twitter.elephantbird.pig.store.LzoPigStorage() AS (request);

loaded = SAMPLE loaded 0.00001;

sized = FOREACH loaded GENERATE Static(request);

DUMP sized;

What's causing the error?

1
Sorry, I fleshed out my question a little bit more.Carl Sagan

1 Answers

1
votes

It appears to be a java.lang.NoClassDefFoundError error that nobody is catching. The error itself occurs because the jvm cannot find the class you requested.

Specifically, you seem to be missing the required directory structure in the jar. com.company.Static (i.e., the Static.class file) should be located under the com/company directory in the jar. See this other SO question for more details.

For a quick fix, take a look at this question on How to create a jar file with package structure.