没有类名的ClassNotFoundException

没有类名的ClassNotFoundException

本文介绍了没有类名的ClassNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在一个jar中添加一个UDF并尝试LOAD。以下是我的片段

 
注册'target / warcbase-0.1.0-SNAPSHOT-fatjar.jar';

DEFINE WarcLoader org.warcbase.pig.WarcLoader();

warc = LOAD'/ raw /'使用WarcLoader AS(网址:chararray,日期:chararray,mime:chararray,内容:bytearray);
STORE warc INTO'/ raw / proc /';

我得到了下面的异常。不幸的是,它并没有告诉我哪个课程没有找到。以下是整个堆栈跟踪

 
后端错误消息
-------------- -------
错误:java.io.IOException:java.lang.ClassNotFoundException:未找到类
,位于org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit.readFields (PigSplit.java:236)
at org.apache.hadoop.io.serializer.WritableSerialization $ WritableDeserializer.deserialize(WritableSerialization.java:71)
at org.apache.hadoop.io.serializer.WritableSerialization $ WritableDeserializer.deserialize(WritableSerialization.java:42)
at org.apache.hadoop.mapred.MapTask.getSplitDetails(MapTask.java:372)
at org.apache.hadoop.mapred.MapTask.runNewMapper (MapTask.java:751)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.YarnChild $ 2.run(YarnChild。 java:163)
在java.security.AccessController.doPrivileged(本地方法)
在javax.security .auth.Subject.doAs(Subject.java:415)
在org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
在org.apache.hadoop.mapred.YarnChild .main(YarnChild.java:158)
导致:java.lang.ClassNotFoundException:类未找到
在org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1982)
at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit.readFields(PigSplit.java:224)
... 10 more

Pig Stack Trace
---------------
错误0:java.io.IOException:java.lang.ClassNotFoundException:未找到类

org.apache。 pig.backend.executionengine.ExecException:错误0:java.io.IOException:java.lang.ClassNotFoundException:未找到类
在org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher.getStats(MapReduceLauncher .java:819)
at org.apache.pig.backend.hadoop.executionengine.mapReduceLa yer.MapReduceLauncher.launchPig(MapReduceLauncher.java:452)
at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.launchPig(HExecutionEngine.java:280)
at org.apache.pig。 PigServer.launchPlan(PigServer.java:1390)
at org.apache.pig.PigServer.executeCompiledLogicalPlan(PigServer.java:1375)
at org.apache.pig.PigServer.execute(PigServer.java: 1364)
在org.apache.pig.PigServer.executeBatch(PigServer.java:415)
在org.apache.pig.PigServer.executeBatch(PigServer.java:398)
在org .apache.pig.tools.grunt.GruntParser.executeBatch(GruntParser.java:171)
在org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:234)
。在组织.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:205)
在org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:81)
。在组织.apache.pig.Main.run(Main.java:624)
at org.apache.pig.Main.main(M ain.java:170)在sun.reflect.NativeMethodAccessorImpl.invoke0
(本机方法)
处sun.reflect sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
。 DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.run(RunJar。 java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
导致:java.io.IOException:java.lang.ClassNotFoundException:未找到类
at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit.readFields(PigSplit.java:236)
at org.apache.hadoop.io.serializer.WritableSerialization $ WritableDeserializer.deserialize(WritableSerialization .java:71)
at org.apache.hadoop.io.serializer.WritableSerialization $ WritableDeserializer.deserialize(WritableSerialization.java:42)
at org.apache.hadoop.mapred.M apTask.getSplitDetails(MapTask.java:372)
在org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:751)
在org.apache.hadoop.mapred.MapTask.run( MapTask.java:341)
at org.apache.hadoop.mapred.YarnChild $ 2.run(YarnChild.java:163)
at java.security.AccessController.doPrivileged(Native Method)
在javax.security.auth.Subject.doAs(Subject.java:415)
在org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
在org.apache.hadoop抛出java.lang.ClassNotFoundException:.mapred.YarnChild.main(YarnChild.java:158)
。通过致类未发现
。在org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java: 1982)
at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit.readFields(PigSplit.java:224)


请帮我解释一下如何从这里开始。

解决方案

确保你的UDF jar包含在你的Pig ClASSPATH中。
添加以下环境变量:

export PIG_CLASSPATH = / to / jar / location:$ PIG_HOME / pig-0.15.0-h2.jar:$ PIG_CLASSPATH

I tried adding a UDF in a jar and tried the LOAD. The following is my snippet

register 'target/warcbase-0.1.0-SNAPSHOT-fatjar.jar';

DEFINE WarcLoader org.warcbase.pig.WarcLoader();

warc = LOAD '/raw/' USING WarcLoader AS (url: chararray, date: chararray, mime: chararray, content: bytearray);
STORE warc INTO '/raw/proc/';

I got the following Exception. Unfortunately, it does not tell me which class was not found. The following is the entire stack trace

Backend error message
---------------------
Error: java.io.IOException: java.lang.ClassNotFoundException: Class  not found
        at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit.readFields(PigSplit.java:236)
        at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:71)
        at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:42)
        at org.apache.hadoop.mapred.MapTask.getSplitDetails(MapTask.java:372)
        at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:751)
        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
        at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:415)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
        at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.ClassNotFoundException: Class  not found
        at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1982)
        at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit.readFields(PigSplit.java:224)
        ... 10 more

Pig Stack Trace
---------------
ERROR 0: java.io.IOException: java.lang.ClassNotFoundException: Class  not found

org.apache.pig.backend.executionengine.ExecException: ERROR 0: java.io.IOException: java.lang.ClassNotFoundException: Class  not found
        at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher.getStats(MapReduceLauncher.java:819)
        at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher.launchPig(MapReduceLauncher.java:452)
        at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.launchPig(HExecutionEngine.java:280)
        at org.apache.pig.PigServer.launchPlan(PigServer.java:1390)
        at org.apache.pig.PigServer.executeCompiledLogicalPlan(PigServer.java:1375)
        at org.apache.pig.PigServer.execute(PigServer.java:1364)
        at org.apache.pig.PigServer.executeBatch(PigServer.java:415)
        at org.apache.pig.PigServer.executeBatch(PigServer.java:398)
        at org.apache.pig.tools.grunt.GruntParser.executeBatch(GruntParser.java:171)
        at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:234)
        at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:205)
        at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:81)
        at org.apache.pig.Main.run(Main.java:624)
        at org.apache.pig.Main.main(Main.java:170)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.io.IOException: java.lang.ClassNotFoundException: Class  not found
        at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit.readFields(PigSplit.java:236)
        at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:71)
        at org.apache.hadoop.io.serializer.WritableSerialization$WritableDeserializer.deserialize(WritableSerialization.java:42)
        at org.apache.hadoop.mapred.MapTask.getSplitDetails(MapTask.java:372)
        at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:751)
        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
        at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:415)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
        at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.ClassNotFoundException: Class  not found
        at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1982)
        at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit.readFields(PigSplit.java:224)


Please help me on how to proceed from here.

解决方案

Make sure that your UDF jar is in your Pig ClASSPATH.Add the following environment variable:

export PIG_CLASSPATH=/to/jar/location:$PIG_HOME/pig-0.15.0-h2.jar:$PIG_CLASSPATH

这篇关于没有类名的ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 05:13