Dou Shen
Dou Shen

Reputation: 101

pig: java.lang.NoClassDefFoundError: org/jruby/embed/ScriptingContainer

pig 0.10.0 supports ruby UDF. So, i am trying a very simple example. but got the following error. Do you know why?

Pig Stack Trace
--------------- ERROR 2998: Unhandled internal error. org/jruby/embed/ScriptingContainer

java.lang.NoClassDefFoundError: org/jruby/embed/ScriptingContainer  at
org.apache.pig.scripting.jruby.JrubyScriptEngine.<clinit>(JrubyScriptEngine.java:65)
    at java.lang.Class.forName0(Native Method)  at
java.lang.Class.forName(Class.java:169)     at
org.apache.pig.scripting.ScriptEngine.getInstance(ScriptEngine.java:254)
    at org.apache.pig.PigServer.registerCode(PigServer.java:523)    at
org.apache.pig.tools.grunt.GruntParser.processRegister(GruntParser.java:422)
    at
org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:419)
    at
org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:189)
    at
org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:165)
    at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:84)     at
org.apache.pig.Main.run(Main.java:555)  at
org.apache.pig.Main.main(Main.java:111)     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:156) Caused by:
java.lang.ClassNotFoundException: org.jruby.embed.ScriptingContainer
    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)   ... 17 more
================================================================================

Upvotes: 3

Views: 1210

Answers (2)

Adrien Schuler
Adrien Schuler

Reputation: 2425

I had to explicitly put the jruby.jar in the classpath doing:

java -cp $PIG_HOME/pig-0.11.1.jar:$PIG_HOME/lib/jruby.jar org.apache.pig.Main -x local myscript.pig

Upvotes: 0

jeff
jeff

Reputation: 53

I had the same problem. You should look to see if you have a jruby.jar installed w pig.

Seems like the jython.jar was there so maybe that's a friendly nudge for people to use python.

Upvotes: 1

Related Questions