java NoClassDefFoundError: org/apache/hadoop/conf/Configuration
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32285197/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
NoClassDefFoundError: org/apache/hadoop/conf/Configuration
提问by Hüseyin Kuyucu
I am trying to install oozie and getting this error.I have hadoop 2.7.1, maven 3.3.3 .Any suggestion on this?
我正在尝试安装 oozie 并收到此错误。我有 hadoop 2.7.1、maven 3.3.3。对此有什么建议吗?
huseyin@ubuntu:~$ '/usr/local/oozie/oozie/Oozie/oozie-4.3.0-SNAPSHOT/bin/oozie-setup.sh' sharelib create -fs hdfs://hadoopcluster:10000 setting CATALINA_OPTS="$CATALINA_OPTS -Xmx1024m"
Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526) Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.conf.Configuration at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 7 more
huseyin@ubuntu:~$ '/usr/local/oozie/oozie/Oozie/oozie-4.3.0-SNAPSHOT/bin/oozie-setup.sh' sharelib create -fs hdfs://hadoopcluster:10000 setting CATALINA_OPTS="$ CATALINA_OPTS -Xmx1024m"
错误:发生 JNI 错误,请检查您的安装并重试线程“main”中的异常 java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration at java.lang.Class.getDeclaredMethods0(Native Method) at java .lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class。 getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526) 引起:java.lang.ClassNotFoundException: org.apache .hadoop.conf.Configuration at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 在 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) 在 java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 7 更多
回答by Ahmed Kamal
You need to add all the needed jars for oozie to a new folder in your working directory (oozie-4.3.0-SNAPSHOT) called libext , please check the following paragraph from oozie docs
您需要将 oozie 所需的所有 jar 添加到您的工作目录 (oozie-4.3.0-SNAPSHOT) 中名为 libext 的新文件夹中,请查看 oozie docs 中的以下段落
By default, oozie war will not contain hadoop and hcatalog libraries, however they are required for oozie to work.
There are 2 options to add these libraries:
At install time, copy the hadoop and hcatalog libraries to libext and run oozie-setup.sh to setup oozie war.
Build with -Puber which will bundle the required libraries in the oozie war.
默认情况下,oozie war 将不包含 hadoop 和 hcatalog 库,但它们是 oozie 工作所必需的。
有两个选项可以添加这些库:
在安装时,将 hadoop 和 hcatalog 库复制到 libext 并运行 oozie-setup.sh 以设置 oozie war。
使用 -Puber 构建,它将在 oozie War中捆绑所需的库。
so to solve the problem you need to :
所以要解决你需要的问题:
1- Create a libext/ directory in the directory where Oozie was expanded.
1- 在 Oozie 展开的目录中创建一个 libext/ 目录。
2- If using the ExtJS library copy the ZIP file to the libext/ directory.
2- 如果使用 ExtJS 库,请将 ZIP 文件复制到 libext/ 目录。
3- If hadoop and hcatalog libraries are not already included in the war, add the corresponding libraries to libext/ directory. (In your case ) , you can just copy all the jars from your hadoop project project to the libext folder.
3- 如果 war 中尚未包含 hadoop 和 hcatalog 库,请将相应的库添加到 libext/ 目录中。(在您的情况下),您可以将所有 jars 从您的 hadoop 项目项目复制到 libext 文件夹。
Important Note: the versions of the jars inside the libext folder should match the versions of those installed during the build process.
重要说明:libext 文件夹中的 jar 版本应与构建过程中安装的版本相匹配。
You can find the versions of the ones downloaded in the pom file you used during the build process.
您可以在构建过程中使用的 pom 文件中找到下载的版本。
回答by Yousef Irman
cp $HADOOP_HOME/share/hadoop/**/*.jar libext/
cp $HADOOP_HOME/share/hadoop/common/*.jar libext/
cp $HADOOP_HOME/share/hadoop/common/lib/*.jar libext/
cp $HADOOP_HOME/share/hadoop/hdfs/lib/*.jar libext/
cp $HADOOP_HOME/share/hadoop/hdfs/*.jar libext/
cp $HADOOP_HOME/share/hadoop/mapreduce/*.jar libext/
cp $HADOOP_HOME/share/hadoop/mapreduce/lib/*.jar libext/
cp $HADOOP_HOME/share/hadoop/yarn/lib/*.jar libext/
cp $HADOOP_HOME/share/hadoop/yarn/*.jar libext/