java—当执行“accumullo/init”命令时,我在hadoop中得到一个noclassdeffounderror

bmvo0sr5  于 2021-06-03  发布在  Hadoop
关注(0)|答案(2)|浏览(386)

我使用的是hadoop.2.2.0,当我尝试初始化acumulo时,出现了以下错误。hadoop和zookeeper正在这个系统上运行。

root@ps-ubuntuhost2:/usr/local/bin/accumulo-1.5.0/bin# ./accumulo init
        Thread "init" died null
    java.lang.reflect.InvocationTargetException
            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:601)
            at org.apache.accumulo.start.Main$1.run(Main.java:101)
            at java.lang.Thread.run(Thread.java:722)
    Caused by: java.lang.NoClassDefFoundError: org/apache/hadoop/util/PlatformName
            at org.apache.hadoop.security.UserGroupInformation.getOSLoginModuleName(UserGroupInformation.java:303)
            at org.apache.hadoop.security.UserGroupInformation.<clinit>(UserGroupInformation.java:348)
            at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2590)
            at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2582)
            at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2448)
            at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:367)
            at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:166)
            at org.apache.accumulo.core.file.FileUtil.getFileSystem(FileUtil.java:550)
            at org.apache.accumulo.server.util.Initialize.main(Initialize.java:485)
            ... 6 more
    Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.util.PlatformName
            at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
            at org.apache.accumulo.start.classloader.AccumuloClassLoader$2.loadClass(AccumuloClassLoader.java:241)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
            ... 15 more

./accumulo classpath命令的输出

root@ps-ubuntuhost2:/usr/local/bin/accumulo-1.5.0/bin# ./accumulo classpath
    Level 1: Java System Classloader (loads Java system resources) URL classpath items are:
    file:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/dnsns.jar
    file:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/sunpkcs11.jar
    file:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/zipfs.jar
    file:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/pulse-java.jar
    file:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/localedata.jar
    file:/usr/lib/x86_64-linux-gnu/jni/libatk-wrapper.so.0.0.18
    file:/usr/share/java/java-atk-wrapper.jar
    file:/usr/lib/jvm/java-7-openjdk-common/jre/lib/ext/sunjce_provider.jar
Level 2: Java Classloader (loads everything defined by java classpath) URL classpath items are:
    file:/usr/local/bin/accumulo-1.5.0/conf/
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-start.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/common/lib/log4j-1.2.17.jar

Level 3: Accumulo Classloader (loads everything defined by general.classpaths) URL classpath items are:
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-server.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-core.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-start.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-fate.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-proxy.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/jcommander.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-examples-simple.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/commons-vfs2.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-fate.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/libthrift.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-proxy.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/jline.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-start.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-test.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-server.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/guava.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-minicluster.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-core.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/log4j-1.2.17.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/gson.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/accumulo-trace.jar
    file:/usr/local/bin/accumulo-1.5.0/lib/commons-logging-1.1.3.jar
    file:/usr/local/bin/zookeeper-3.4.5/zookeeper-3.4.5.jar
    file:/usr/local/bin/hadoop-2.2.0/etc/hadoop/
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/common/hadoop-common-2.2.0-tests.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/common/hadoop-common-2.2.0.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/common/hadoop-nfs-2.2.0.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/hadoop-hdfs-nfs-2.2.0.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/hadoop-hdfs-2.2.0-tests.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/hadoop-hdfs-2.2.0.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/jsp-api-2.1.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/jasper-runtime-5.5.23.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/jackson-core-asl-1.8.8.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/jetty-6.1.26.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/asm-3.2.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/commons-logging-1.1.1.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/xmlenc-0.52.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/commons-daemon-1.0.13.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/commons-io-2.1.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/commons-el-1.0.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/jsr305-1.3.9.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/servlet-api-2.5.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/commons-codec-1.4.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/protobuf-java-2.5.0.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/commons-lang-2.5.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/jersey-server-1.9.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/guava-11.0.2.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/log4j-1.2.17.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/jetty-util-6.1.26.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/netty-3.6.2.Final.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/jersey-core-1.9.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/jackson-mapper-asl-1.8.8.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/hdfs/lib/commons-cli-1.2.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/tools/lib/hadoop-gridmix-2.2.0.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/tools/lib/hadoop-extras-2.2.0.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/tools/lib/hadoop-streaming-2.2.0.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/tools/lib/hadoop-archives-2.2.0.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/tools/lib/hadoop-datajoin-2.2.0.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/tools/lib/hadoop-distcp-2.2.0.jar
    file:/usr/local/bin/hadoop-2.2.0/share/hadoop/tools/lib/hadoop-rumen-2.2.0.jar
    file:/usr/local/commons-configuration-1.10/commons-configuration-1.10.jar

感谢您的帮助。

omvjsjqw

omvjsjqw1#

确保在类路径中添加hadoop核心jar。关于如何调试noclassdeffounderror,您可以参考本文

0h4hbjxa

0h4hbjxa2#

您的类路径上似乎缺少common/lib目录(/usr/local/bin/hadoop-2.2.0/share/hadoop/common/lib)。您缺少的类位于common/lib中的hadoop-auth-2.2.0.jar中。确保在accumulo-site.xml文件中的general.classpath中添加了一行类似于“$hadoop\u prefix/share/hadoop/common/lib/*.jar”的内容。

相关问题