hadoop hbase導致報錯(NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration)

NO IMAGE
Exception in thread “main” java.io.IOException: Error opening job jar: ./ADReport2Hbase_0309.jar
        at org.apache.hadoop.util.RunJar.main(RunJar.java:90)
Caused by: java.util.zip.ZipException: error in opening zip file
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.(ZipFile.java:127)
        at java.util.jar.JarFile.(JarFile.java:135)

       

at java.util.jar.JarFile.(JarFile.java:72)

        at org.apache.hadoop.util.RunJar.main(RunJar.java:88)
錯誤:未找到./ADReport2Hbase_0309.jar包,路徑為找到。
Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration
        at com.wonderad.mr.ADReport2HBase.main(ADReport2HBase.java:152)
        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.apache.hadoop.hbase.HBaseConfiguration
        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 java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        … 6 more
錯誤:調遣hbase包錯誤,配置檔案不能載入。
解決:將hbase目錄下jar包拷貝到hadoop/lib下。
以下都是未找到jar包,解決方法如上,將hadoop載入的應用程式jar拷貝到hadoop/lib下。
1、zookeeper
Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/zookeeper/KeeperException
        at org.apache.hadoop.hbase.client.HConnectionManager.getConnection(HConnectionManager.java:183)
        at org.apache.hadoop.hbase.client.HBaseAdmin.(HBaseAdmin.java:99)
        at com.wonderad.mr.ADReport2HBase.createTable(ADReport2HBase.java:194)
        at com.wonderad.mr.ADReport2HBase.main(ADReport2HBase.java:159)
        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.apache.zookeeper.KeeperException
        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)
        … 9 more
2、hbase/protobuf
Exception in thread “main” java.lang.NoClassDefFoundError: com/google/protobuf/Message
        at org.apache.hadoop.hbase.io.HbaseObjectWritable.(HbaseObjectWritable.java:263)
        at org.apache.hadoop.hbase.ipc.Invocation.write(Invocation.java:138)
        at org.apache.hadoop.hbase.ipc.HBaseClient$Connection.sendParam(HBaseClient.java:537)
        at org.apache.hadoop.hbase.ipc.HBaseClient.call(HBaseClient.java:899)
        at org.apache.hadoop.hbase.ipc.WritableRpcEngine$Invoker.invoke(WritableRpcEngine.java:150)
        at $Proxy5.getProtocolVersion(Unknown Source)
        at org.apache.hadoop.hbase.ipc.WritableRpcEngine.getProxy(WritableRpcEngine.java:183)
        at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:335)
        at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:312)
        at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:364)
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:665)
        at org.apache.hadoop.hbase.client.HBaseAdmin.(HBaseAdmin.java:109)
        at com.wonderad.mr.ADReport2HBase.createTable(ADReport2HBase.java:194)
        at com.wonderad.mr.ADReport2HBase.main(ADReport2HBase.java:159)
        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: com.google.protobuf.Message
        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)
        … 19 more
原文出自:http://blog.sina.com.cn/s/blog_474edf960101ja1z.html