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

时间:2012-07-19 01:17:34

标签: ruby user-defined-functions apache-pig

猪0.10.0支持ruby UDF。所以,我正在尝试一个非常简单的例子。但得到以下错误。你知道为什么吗?

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
================================================================================

2 个答案:

答案 0 :(得分:1)

我遇到了同样的问题。你应该看看你是否安装了jruby.jar。

似乎jython.jar就在那里,所以也许这是对人们使用python的友好推动。

答案 1 :(得分:0)

我必须明确地将jruby.jar放在类路径中:

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