Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
-
Patch Available
Description
Pig package does not include the jython jar within lib/ directory with the jar-all ant target but includes it in the "ant package" target. It should be including it in both targets as often, the build/ directory is excluded from packaging which is where ivy puts all the dependency jars while building under build/ivy/lib/Pig
To reproduce:
ant jar-all
rm -rf build/
bin/pig
grunt> register '/tmp/test.py' using jython as myfunction;
If done prior to installing jython, here's the error one gets:
2013-12-27 18:22:31,145 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR
2998: Unhandled internal error. org/python/core/PyObject
Details at logfile: pig_*.log
Within the pig_*.log =>
<log>
Pig Stack Trace
---------------
ERROR 2998: Unhandled internal error. org/python/core/PyObject
java.lang.NoClassDefFoundError: org/python/core/PyObject
at
org.apache.pig.scripting.jython.JythonScriptEngine.registerFunctions(JythonScriptEngine.java:304)
at org.apache.pig.PigServer.registerCode(PigServer.java:501)
at
org.apache.pig.tools.grunt.GruntParser.processRegister(GruntParser.java:436)
at
org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:445)
at
org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
at
org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:170)
at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:69)
at org.apache.pig.Main.run(Main.java:538)
at org.apache.pig.Main.main(Main.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.RunJar.main(RunJar.java:197)
Caused by: java.lang.ClassNotFoundException: org.python.core.PyObject
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 14 more
Fix: Including jython*.jar within the lib/ directory gets rid of this issue and the UDF can be loaded-
grunt> register '/tmp/test.py' using jython as myfuncs;
2013-12-27 18:37:02,402 [main] INFO
org.apache.pig.scripting.jython.JythonScriptEngine - created tmp
python.cachedir=/tmp/pig_jython_4887743829482443898
2013-12-27 18:37:03,448 [main] WARN
org.apache.pig.scripting.jython.JythonScriptEngine - pig.cmd.args.remainders is
empty. This is not expected unless on testing.
2013-12-27 18:37:03,724 [main] INFO
org.apache.pig.scripting.jython.JythonScriptEngine - Register scripting UDF:
myfuncs.helloworld