hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manish dunani <manishd...@gmail.com>
Subject NoClassDefFoundError while executing java hbase client programme
Date Wed, 07 Aug 2013 13:02:53 GMT
hello,

I wrote the programme to insert the data into hbase table..


*code:*

package maddy.test;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;

public class dataenter
{
    public static void main(String args[]) throws IOException
    {


    Configuration config=HBaseConfiguration.create();

    HTable table = new HTable(config,"testtable");

    Put put=new Put(Bytes.toBytes("row1"));

put.add(Bytes.toBytes("columnfamily1"),Bytes.toBytes("cv1"),Bytes.toBytes("manish"));

put.add(Bytes.toBytes("columnfamily2"),Bytes.toBytes("cv2"),Bytes.toBytes("vigs"));

put.add(Bytes.toBytes("columnfamily3"),Bytes.toBytes("cv3"),Bytes.toBytes("amardas"));

    table.put(put);
    }


}

*Dependencies:*

lib
├── commons-configuration-1.6.jar
├── commons-lang-2.5.jar
├── commons-logging-1.1.1.jar
├── hadoop-core-1.0.4.jar
├── hbase-0.94.9.jar
├── log4j-1.2.16.jar
├── slf4j-api-1.4.3.jar
├── slf4j-log4j12-1.4.3.jar
└── zookeeper-3.4.5.jar

*hbase-site.xml:

*
<configuration>
    <property>
        <name>hbase.cluster.distributed</name>
        <value>true</value>
    </property>
    <property>
        <name>hbase.rootdir</name>
        <value>hdfs://localhost:54310/hbase</value>
        <description>The directory shared by RegionServers.
        </description>
    </property>
    <property>
        <name>dfs.replication</name>
        <value>1</value>
        <description>The replication count for HLog and HFile storage.
Should not be greater
           than HDFS datanode count.
       </description>
    </property>
    </configuration>

*Error:*

13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client
environment:zookeeper.version=3.4.5-1392090, built on 09/30/2012 17:52 GMT
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client environment:host.name
=localhost
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client
environment:java.version=1.7.0_21
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client
environment:java.vendor=Oracle Corporation
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client
environment:java.home=/usr/lib/jvm/java-7-openjdk-i386/jre
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client
environment:java.class.path=/home/manish/workspace/hbase
project/bin:/usr/local/hbase/hbase-0.94.9.jar:/usr/local/hbase/lib/commons-configuration-1.6.jar:/usr/local/hbase/lib/commons-lang-2.5.jar:/usr/local/hbase/lib/commons-logging-1.1.1.jar:/usr/local/hbase/lib/hadoop-core-1.0.4.jar:/usr/local/hbase/lib/log4j-1.2.16.jar:/usr/local/hbase/lib/slf4j-api-1.4.3.jar:/usr/local/hbase/lib/slf4j-log4j12-1.4.3.jar:/usr/local/hbase/lib/zookeeper-3.4.5.jar
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client
environment:java.library.path=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/client:/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386::/usr/java/packages/lib/i386:/usr/lib/jni:/lib:/usr/lib
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client
environment:java.io.tmpdir=/tmp
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client
environment:java.compiler=<NA>
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client environment:os.name=Linux
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client environment:os.arch=i386
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client
environment:os.version=3.8.0-19-generic
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client environment:user.name
=manish
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client
environment:user.home=/home/manish
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Client
environment:user.dir=/home/manish/workspace/hbase project
13/08/07 05:33:45 INFO zookeeper.ZooKeeper: Initiating client connection,
connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection
13/08/07 05:33:45 INFO zookeeper.RecoverableZooKeeper: The identifier of
this process is 9311@ubuntu
13/08/07 05:33:45 INFO zookeeper.ClientCnxn: Opening socket connection to
server localhost/127.0.0.1:2181. Will not attempt to authenticate using
SASL (unknown error)
13/08/07 05:33:45 INFO zookeeper.ClientCnxn: Socket connection established
to localhost/127.0.0.1:2181, initiating session
13/08/07 05:33:46 INFO zookeeper.ClientCnxn: Session establishment complete
on server localhost/127.0.0.1:2181, sessionid = 0x14058258d270009,
negotiated timeout = 180000
Exception in thread "main" java.lang.NoClassDefFoundError:
com/google/protobuf/Message
    at
org.apache.hadoop.hbase.io.HbaseObjectWritable.<clinit>(HbaseObjectWritable.java:265)
    at org.apache.hadoop.hbase.ipc.Invocation.write(Invocation.java:139)
    at
org.apache.hadoop.hbase.ipc.HBaseClient$Connection.sendParam(HBaseClient.java:612)
    at org.apache.hadoop.hbase.ipc.HBaseClient.call(HBaseClient.java:975)
    at
org.apache.hadoop.hbase.ipc.WritableRpcEngine$Invoker.invoke(WritableRpcEngine.java:86)
    at com.sun.proxy.$Proxy5.getProtocolVersion(Unknown Source)
    at
org.apache.hadoop.hbase.ipc.WritableRpcEngine.getProxy(WritableRpcEngine.java:138)
    at org.apache.hadoop.hbase.ipc.HBaseRPC.waitForProxy(HBaseRPC.java:208)
    at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getHRegionConnection(HConnectionManager.java:1370)
    at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getHRegionConnection(HConnectionManager.java:1329)
    at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getHRegionConnection(HConnectionManager.java:1316)
    at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:1001)
    at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:896)
    at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:998)
    at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:900)
    at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:857)
    at org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:233)
    at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:173)
    at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:132)
    at maddy.test.dataenter.main(dataenter.java:19)
Caused by: java.lang.ClassNotFoundException: com.google.protobuf.Message
    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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 20 more

Can any one please tell what need to do??


-- 
MANISH DUNANI
-THANX

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message