java - 使用 Hadoop 时如何解决 NoClassDefFoundError?

标签 java hadoop noclassdeffounderror camus

我正进入(状态

Exception in thread "main" java.lang.NoClassDefFoundError: com/linkedin/camus/etl/IEtlKey.



在运行命令时:
hadoop jar camus-etl-kafka-0.1.0-SNAPSHOT.jar 
com.linkedin.camus.etl.kafka.CamusJob -P camus.properties

我得到以下异常(exception)..
2016-04-27 11:34:04.622 java[13567:351959] Unable to load realm mapping info from SCDynamicStore
[NativeCodeLoader] - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Exception in thread "main" java.lang.NoClassDefFoundError: com/linkedin/camus/etl/IEtlKey
    at com.linkedin.camus.etl.kafka.CamusJob.run(CamusJob.java:252)
    at com.linkedin.camus.etl.kafka.CamusJob.run(CamusJob.java:235)
    at com.linkedin.camus.etl.kafka.CamusJob.run(CamusJob.java:691)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
    at com.linkedin.camus.etl.kafka.CamusJob.main(CamusJob.java:646)
    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.lang.ClassNotFoundException: com.linkedin.camus.etl.IEtlKey

我已包含 camus-example-0.1.0-SNAPSHOT-shaded.jar在类路径中。

如果我遗漏了什么,请告诉我。

提前致谢

苏米亚 git

最佳答案

您应该尝试包含 camus-api您可以在此找到 LinkedIn's previous generation Kafka to HDFS pipeline页面,因为缺少的类包含在此包中,如您所见 here .

注意 Camus 可能需要的其他传递依赖。

此外,当您使用 hadoop jar 时,要确保在类路径中可以找到类。从命令行,您可以添加 libjars命令行选项,如 Using the libjars option with Hadoop 中所述:

$ export LIBJARS=/path/jar1,/path/jar2
$ hadoop jar my-example.jar com.example.MyTool -libjars ${LIBJARS} -mytoolopt value


知道加缪将被地精取代可能会很有用:

Camus is being phased out and replaced by Gobblin. For those using or interested in Camus, we suggest taking a look at Gobblin.

For instructions on Migrating from Camus to Gobblin, please take a look at Camus Gobblin Migration.

关于java - 使用 Hadoop 时如何解决 NoClassDefFoundError?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36881778/

相关文章:

java - 如何在 Ubuntu 中设置临时 Java 类路径

java - 如何忽略登录表单上的Spring数据验证?

java - 在 java 代码中设置 job.properties 文件以启动 oozie 操作

java - 引入中间基类导致ActiveMQ/JMS NoClassDefFoundError

java - 尝试使用 jaxb 解码 xml

java - 对象数组NullPointerException,处理3.3.6

hadoop - 使用Sqoop将数据从Teradata导入到Hive

hadoop - cdh5.1.2是否支持Parquet文件格式

java - 使用 Maven 时,Derby 给出 ClassNotFoundException : org. apache.derby.jdbc.EmbeddedDriver

java.lang.NoClassDefFoundError,但是所有的jar文件都在