Java invoke HBase API appears Org.apache.hadoop.hbase.protobuf.generated.clientprotos$result overrides final error

Source: Internet
Author: User

Today wrote a simple Java code call HBase API, the code is as follows:

public class Hbaseapi {
	private htable htable;
	Private String tablename;
	Public Hbaseapi (String tablename) throws IOException {
		this.tablename = tablename;
		Hbaseconfiguration hconfig = new Hbaseconfiguration ();
		Hconfig.set ("Hbase.zookeeper.property.clientPort", "2181");
		Hconfig.set ("Hbase.zookeeper.quorum", "192.168.179.130");  
		htable = new Htable (Hconfig, This.tableName.getBytes ());
	}
	
	public void Scan (string family, String qualifier) throws IOException {scan
		scan = new scan ();
		Scan.addcolumn (Family.getbytes (), qualifier.getbytes ());
		
		Resultscanner scanner = Htable.getscanner (scan);
		
		for (Result result = Scanner.next (), result!= null, result = Scanner.next ()) {
		}
	} public
	
	static void main (string[] args) {
		try {
			new Hbaseapi ("Teacher"). Scan ("Teacher", "info");;
		} catch (IOException e) {
			E.printstacktrace ();}}
	


An error occurred while executing: from the error point of view, it should be a HBase class overload the Protobuf-java of a final method caused. My version of Hadoop is 2.2.0, hbase version is 0.96,PROTOBUF version is 2.5. If a great God encounters the same problem, please provide the following solutions, and then thank

Java.io.IOException:java.lang.reflect.InvocationTargetException at Org.apache.hadoop.hbase.client.HConnectionManager.createConnection (hconnectionmanager.java:389) at Org.apache.hadoop.hbase.client.HConnectionManager.createConnection (hconnectionmanager.java:366) at Org.apache.hadoop.hbase.client.HConnectionManager.getConnection (hconnectionmanager.java:247) at Org.apache.hadoop.hbase.client.htable.<init> (htable.java:188) at org.apache.hadoop.hbase.client.HTable. <init> (htable.java:165) at com.hadoop.study.hbase.hbaseapi.<init> (hbaseapi.java:19) at Com.hadoop.stud Y.hbase.hbaseapi.main (hbaseapi.java:34) caused by:java.lang.reflect.InvocationTargetException at Sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native method) at Sun.reflect.NativeConstructorAccessorImpl.newInstance (nativeconstructoraccessorimpl.java:39) at Sun.reflect.DelegatingConstructorAccessorImpl.newInstance (delegatingconstructoraccessorimpl.java:27) atJava.lang.reflect.Constructor.newInstance (constructor.java:513) at Org.apache.hadoop.hbase.client.HConnectionManager.createConnection (hconnectionmanager.java:387) ... 6 more caused By:java.lang.VerifyError:class Org.apache.hadoop.hbase.protobuf.generated.clientprotos$result Overrides final method Getunknownfields.
    () Lcom/google/protobuf/unknownfieldset;  At Java.lang.ClassLoader.defineClass1 (Native method) at Java.lang.ClassLoader.defineClass (classloader.java:621) at Java.security.SecureClassLoader.defineClass (secureclassloader.java:124) at Java.net.URLClassLoader.defineClass ( urlclassloader.java:260) at java.net.urlclassloader.access$000 (urlclassloader.java:56) at java.net.URLClassLoader$ 1.run (urlclassloader.java:195) at Java.net.URLClassL, Java.security.AccessController.doPrivileged (Native method) Oader.findclass (urlclassloader.java:188) at Java.lang.ClassLoader.loadClass (classloader.java:307) at Sun.misc.Laun Cher$appclassloader.loadclaSS (launcher.java:301) at Java.lang.ClassLoader.loadClass (classloader.java:252) at Java.lang.ClassLoader.loadClassI Nternal (classloader.java:320) at org.apache.hadoop.hbase.protobuf.protobufutil.<clinit> (ProtobufUtil.java : 172) at Org.apache.hadoop.hbase.ClusterId.parseFrom (clusterid.java:64) at Org.apache.hadoop.hbase.zookeeper.ZKClu Sterid.readclusteridznode (zkclusterid.java:69) at Org.apache.hadoop.hbase.client.ZooKeeperRegistry.getClusterId ( zookeeperregistry.java:83) at org.apache.hadoop.hbase.client.hconnectionmanager$ Hconnectionimplementation.retrieveclusterid (hconnectionmanager.java:801) at Org.apache.hadoop.hbase.client.hconnectionmanager$hconnectionimplementation.<init> ( hconnectionmanager.java:633) ... One more


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.