hadoop+hbase导致报错(NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration)

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.DelegatingMethodAccessor Impl.invoke(DelegatingMethodAccessor Impl.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.DelegatingMethodAccessor Impl.invoke(DelegatingMethodAccessor Impl.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$HConnectionImplementatio n.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.DelegatingMethodAccessor Impl.invoke(DelegatingMethodAccessor Impl.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

你可能感兴趣的:(hadoop,hbase)