这个jar 包冲突,怎么解决

pyboy58 发布于 2015/10/10 15:43
阅读 9K+
收藏 0

OSC年度开源问卷新鲜出炉,你的回答对我们很重要,参与开源可以从这份问卷开始>>>

java 操作hbase ,操作put 不行

package com.mcsys.hbase;

import java.io.IOException;

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

import com.thinkgem.jeesite.common.config.Global;

/**
 * 
 * @Description: hbae处理类 导入数据 进hbase
 * @date 2015年9月15日 
 * @version V1.0
 */
public class testPut {

	@SuppressWarnings("deprecation")
	public static void main(String[] args) throws Exception, ZooKeeperConnectionException, IOException {
		Configuration conf=HBaseConfiguration.create();
		String zookeeper = Global.getConfig("hbase.zookeeper.quorum");

//		conf.set("hbase.zookeeper.quorum", zookeeper);
		conf.set("hbase.zookeeper.quorum", "192.168.20.88");

		
		HBaseAdmin admin = new HBaseAdmin(conf);
			HTable table = new HTable(conf, "userhjz");
		for (int i = 1; i < 10; i++) {
			
			Put put = new Put(Bytes.toBytes("row" +i));
//			put.add(family, qualifier, value) 
			put.add(Bytes.toBytes("info"), Bytes.toBytes("name"), Bytes.toBytes("tom" +i));
			put.add(Bytes.toBytes("phone"), Bytes.toBytes("phone"), Bytes.toBytes("1591832518" +i));
			put.add(Bytes.toBytes("address"), Bytes.toBytes("address"), Bytes.toBytes("address" +i));
			
			System.err.println(i+ "-----put-----" +put.toJSON());
			table.put(put);
		}	
		table.close();
		admin.close();
		System.out.println("**----hbase finish ");
	}

}


 




Exception in thread "main" java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop.hbase.zookeeper.MetaTableLocator

at org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:596)
at org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:580)
at org.apache.hadoop.hbase.zookeeper.MetaTableLocator.blockUntilAvailable(MetaTableLocator.java:559)
at org.apache.hadoop.hbase.client.ZooKeeperRegistry.getMetaRegionLocation(ZooKeeperRegistry.java:61)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateMeta(ConnectionManager.java:1185)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1152)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.relocateRegion(ConnectionManager.java:1126)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegionInMeta(ConnectionManager.java:1331)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1155)
at org.apache.hadoop.hbase.client.AsyncProcess.submit(AsyncProcess.java:370)
at org.apache.hadoop.hbase.client.AsyncProcess.submit(AsyncProcess.java:321)
at org.apache.hadoop.hbase.client.BufferedMutatorImpl.backgroundFlushCommits(BufferedMutatorImpl.java:206)
at org.apache.hadoop.hbase.client.BufferedMutatorImpl.flush(BufferedMutatorImpl.java:183)
at org.apache.hadoop.hbase.client.HTable.flushCommits(HTable.java:1449)
at org.apache.hadoop.hbase.client.HTable.put(HTable.java:1040)
at com.mcsys.hbase.testPut.main(testPut.java:42)

加载中
0
新青年Inc
新青年Inc
https://issues.apache.org/jira/browse/HBASE-14126
0
天空一号2
HBase高级应用实战视频教程  下载地址: http://pan.baidu.com/s/1pLQruoN 密码: 4ghu
b
bolean
该评论暂时无法显示,详情咨询 QQ 群:912889742
0
l
leocook
我的guava包冲突,已解决
Jaming07
Jaming07
该评论暂时无法显示,详情咨询 QQ 群:912889742
0
默一默
默一默
guava包冲突,对比官网给的例子里的改为相同版本就好了
0
状元洪洪
请问怎么解决的
0
单纯的老妖
单纯的老妖
该评论暂时无法显示,详情咨询 QQ 群:912889742
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部