使用hbase的api创建表时出现的异常

 1 /usr/lib/jvm/java-7-openjdk-amd64/bin/java -Didea.launcher.port=7538 -Didea.launcher.bin.path=/usr/local/idea-IC-139.225.3/bin -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rhino.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/compilefontconfig.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/javazic.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/pulse-java.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/java-atk-wrapper.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/sunpkcs11.jar:/root/IdeaProjects/Test/out/production/HbaseTest:/usr/local/hbase-0.90.3/hbase-0.90.3.jar:/usr/local/hbase-0.90.3/lib/activation-1.1.jar:/usr/local/hbase-0.90.3/lib/asm-3.1.jar:/usr/local/hbase-0.90.3/lib/avro-1.3.3.jar:/usr/local/hbase-0.90.3/lib/commons-cli-1.2.jar:/usr/local/hbase-0.90.3/lib/commons-codec-1.4.jar:/usr/local/hbase-0.90.3/lib/commons-el-1.0.jar:/usr/local/hbase-0.90.3/lib/commons-httpclient-3.1.jar:/usr/local/hbase-0.90.3/lib/commons-lang-2.5.jar:/usr/local/hbase-0.90.3/lib/commons-logging-1.1.1.jar:/usr/local/hbase-0.90.3/lib/commons-net-1.4.1.jar:/usr/local/hbase-0.90.3/lib/core-3.1.1.jar:/usr/local/hbase-0.90.3/lib/guava-r06.jar:/usr/local/hbase-0.90.3/lib/hadoop-0.20.2-core.jar:/usr/local/hbase-0.90.3/lib/jackson-core-asl-1.5.5.jar:/usr/local/hbase-0.90.3/lib/jackson-jaxrs-1.5.5.jar:/usr/local/hbase-0.90.3/lib/jackson-mapper-asl-1.4.2.jar:/usr/local/hbase-0.90.3/lib/jackson-xc-1.5.5.jar:/usr/local/hbase-0.90.3/lib/jasper-compiler-5.5.23.jar:/usr/local/hbase-0.90.3/lib/jasper-runtime-5.5.23.jar:/usr/local/hbase-0.90.3/lib/jaxb-api-2.1.jar:/usr/local/hbase-0.90.3/lib/jaxb-impl-2.1.12.jar:/usr/local/hbase-0.90.3/lib/jersey-core-1.4.jar:/usr/local/hbase-0.90.3/lib/jersey-json-1.4.jar:/usr/local/hbase-0.90.3/lib/jersey-server-1.4.jar:/usr/local/hbase-0.90.3/lib/jettison-1.1.jar:/usr/local/hbase-0.90.3/lib/jetty-6.1.26.jar:/usr/local/hbase-0.90.3/lib/jetty-util-6.1.26.jar:/usr/local/hbase-0.90.3/lib/jruby-complete-1.6.0.jar:/usr/local/hbase-0.90.3/lib/jsp-2.1-6.1.14.jar:/usr/local/hbase-0.90.3/lib/jsp-api-2.1-6.1.14.jar:/usr/local/hbase-0.90.3/lib/jsr311-api-1.1.1.jar:/usr/local/hbase-0.90.3/lib/log4j-1.2.16.jar:/usr/local/hbase-0.90.3/lib/protobuf-java-2.3.0.jar:/usr/local/hbase-0.90.3/lib/servlet-api-2.5-6.1.14.jar:/usr/local/hbase-0.90.3/lib/slf4j-api-1.5.8.jar:/usr/local/hbase-0.90.3/lib/slf4j-log4j12-1.5.8.jar:/usr/local/hbase-0.90.3/lib/stax-api-1.0.1.jar:/usr/local/hbase-0.90.3/lib/thrift-0.2.0.jar:/usr/local/hbase-0.90.3/lib/xmlenc-0.52.jar:/usr/local/hbase-0.90.3/lib/zookeeper-3.3.2.jar:/usr/local/idea-IC-139.225.3/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain PutEcample
 2 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.3.2-1031432, built on 11/05/2010 05:32 GMT
 3 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:host.name=localhost
 4 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:java.version=1.7.0_65
 5 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:java.vendor=Oracle Corporation
 6 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:java.home=/usr/lib/jvm/java-7-openjdk-amd64/jre
 7 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:java.class.path=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rhino.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/compilefontconfig.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/javazic.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/pulse-java.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/java-atk-wrapper.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/sunpkcs11.jar:/root/IdeaProjects/Test/out/production/HbaseTest:/usr/local/hbase-0.90.3/hbase-0.90.3.jar:/usr/local/hbase-0.90.3/lib/activation-1.1.jar:/usr/local/hbase-0.90.3/lib/asm-3.1.jar:/usr/local/hbase-0.90.3/lib/avro-1.3.3.jar:/usr/local/hbase-0.90.3/lib/commons-cli-1.2.jar:/usr/local/hbase-0.90.3/lib/commons-codec-1.4.jar:/usr/local/hbase-0.90.3/lib/commons-el-1.0.jar:/usr/local/hbase-0.90.3/lib/commons-httpclient-3.1.jar:/usr/local/hbase-0.90.3/lib/commons-lang-2.5.jar:/usr/local/hbase-0.90.3/lib/commons-logging-1.1.1.jar:/usr/local/hbase-0.90.3/lib/commons-net-1.4.1.jar:/usr/local/hbase-0.90.3/lib/core-3.1.1.jar:/usr/local/hbase-0.90.3/lib/guava-r06.jar:/usr/local/hbase-0.90.3/lib/hadoop-0.20.2-core.jar:/usr/local/hbase-0.90.3/lib/jackson-core-asl-1.5.5.jar:/usr/local/hbase-0.90.3/lib/jackson-jaxrs-1.5.5.jar:/usr/local/hbase-0.90.3/lib/jackson-mapper-asl-1.4.2.jar:/usr/local/hbase-0.90.3/lib/jackson-xc-1.5.5.jar:/usr/local/hbase-0.90.3/lib/jasper-compiler-5.5.23.jar:/usr/local/hbase-0.90.3/lib/jasper-runtime-5.5.23.jar:/usr/local/hbase-0.90.3/lib/jaxb-api-2.1.jar:/usr/local/hbase-0.90.3/lib/jaxb-impl-2.1.12.jar:/usr/local/hbase-0.90.3/lib/jersey-core-1.4.jar:/usr/local/hbase-0.90.3/lib/jersey-json-1.4.jar:/usr/local/hbase-0.90.3/lib/jersey-server-1.4.jar:/usr/local/hbase-0.90.3/lib/jettison-1.1.jar:/usr/local/hbase-0.90.3/lib/jetty-6.1.26.jar:/usr/local/hbase-0.90.3/lib/jetty-util-6.1.26.jar:/usr/local/hbase-0.90.3/lib/jruby-complete-1.6.0.jar:/usr/local/hbase-0.90.3/lib/jsp-2.1-6.1.14.jar:/usr/local/hbase-0.90.3/lib/jsp-api-2.1-6.1.14.jar:/usr/local/hbase-0.90.3/lib/jsr311-api-1.1.1.jar:/usr/local/hbase-0.90.3/lib/log4j-1.2.16.jar:/usr/local/hbase-0.90.3/lib/protobuf-java-2.3.0.jar:/usr/local/hbase-0.90.3/lib/servlet-api-2.5-6.1.14.jar:/usr/local/hbase-0.90.3/lib/slf4j-api-1.5.8.jar:/usr/local/hbase-0.90.3/lib/slf4j-log4j12-1.5.8.jar:/usr/local/hbase-0.90.3/lib/stax-api-1.0.1.jar:/usr/local/hbase-0.90.3/lib/thrift-0.2.0.jar:/usr/local/hbase-0.90.3/lib/xmlenc-0.52.jar:/usr/local/hbase-0.90.3/lib/zookeeper-3.3.2.jar:/usr/local/idea-IC-139.225.3/lib/idea_rt.jar
 8 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:java.library.path=/usr/local/idea-IC-139.225.3/bin::/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
 9 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp
10 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
11 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:os.name=Linux
12 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:os.arch=amd64
13 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:os.version=3.8.0-44-generic
14 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:user.name=root
15 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:user.home=/root
16 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Client environment:user.dir=/root/IdeaProjects/Test
17 15/01/04 11:18:17 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection
18 15/01/04 11:18:17 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181
19 15/01/04 11:18:17 INFO zookeeper.ClientCnxn: Socket connection established to localhost/127.0.0.1:2181, initiating session
20 15/01/04 11:18:17 INFO zookeeper.ClientCnxn: Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x14ab2ae95630011, negotiated timeout = 40000
21 15/01/04 11:18:17 WARN client.HConnectionManager$HConnectionImplementation: Encountered problems when prefetch META table:
22 org.apache.hadoop.hbase.TableNotFoundException: Cannot find row in .META. for table: testtable9, row=testtable9,,99999999999999
23     at org.apache.hadoop.hbase.client.MetaScanner.metaScan(MetaScanner.java:136)
24     at org.apache.hadoop.hbase.client.MetaScanner.metaScan(MetaScanner.java:95)
25     at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.prefetchRegionCache(HConnectionManager.java:648)
26     at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:702)
27     at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:593)
28     at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:558)
29     at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:172)
30     at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:146)
31     at PutEcample.main(PutEcample.java:21)
32     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
33     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
34     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
35     at java.lang.reflect.Method.invoke(Method.java:606)
36     at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
37 Exception in thread "main" org.apache.hadoop.hbase.TableNotFoundException: testtable9
38     at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegionInMeta(HConnectionManager.java:724)
39     at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:593)
40     at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.locateRegion(HConnectionManager.java:558)
41     at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:172)
42     at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:146)
43     at PutEcample.main(PutEcample.java:21)
44     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
45     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
46     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
47     at java.lang.reflect.Method.invoke(Method.java:606)
48     at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
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 java.io.IOException;

public class PutEcample {
    public static void main(String[] args) throws IOException{
        Configuration conf= HBaseConfiguration.create();
        HBaseAdmin hbase=new HBaseAdmin(conf);
        HTableDescriptor desc=new HTableDescriptor("testtable1");
        HColumnDescriptor colfam1=new HColumnDescriptor("colfam1".getBytes());
        desc.addFamily(colfam1);
        hbase.createTable(desc);
        HTable table=new HTable(conf,"testtable1");
        Put put=new Put(Bytes.toBytes("row1"));
        put.add(Bytes.toBytes("colfam1"),Bytes.toBytes("qual1"),Bytes.toBytes("val1"));
        //Put.add(Bytes.toBytes("colfam1"),Bytes.toBytes("qual2"),Bytes.toBytes("val2"));
        table.put(put);
        System.out.println("ok");
    }
}

使用hbase的api创建表时要先创建表的结构。

时间: 2024-11-14 22:36:25

使用hbase的api创建表时出现的异常的相关文章

(转)mysql创建表时反引号的作用

(转)mysql创建表时反引号的作用 试用navicat工具查看现网mysql建表语句时,发现表名和字段名都是反引号引起来的 1 2 3 4 5 6 7 8 9 10 11 CREATE TABLE `tab_notice_title_tv` (   `i_id` int(11) NOT NULL AUTO_INCREMENT,   `c_opcom_key` varchar(32) DEFAULT NULL,   `c_view_type` int(11) DEFAULT '1' COMMEN

MySQL 创建表时,设置时间字段自己主动插入当前时间

MySQL 创建表时,设置时间字段自己主动插入当前时间 DROP TABLE IF EXISTS `CONTENT`; CREATE TABLE `CONTENT` ( `ID` char(20) NOT NULL, `CURRENT_TIME` timestamp not null default current_timestamp, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Oracle创建表时涉及的参数解析

1.oracle pctfree和pctused详解   http://www.cnblogs.com/linjiqin/archive/2012/01/16/2323320.html http://blog.csdn.net/huang_xw/article/details/6995442 2.Oracle中用创建表时Storage中参数的含义 http://www.cnblogs.com/rootq/articles/1089383.html

oracle与mysql创建表时的区别

oracle创建表时,不支持在建表时同时增加字段注释.故采用以下方式: #创建表CREATE TABLE predict_data as ( id integer NOT NULL, uid varchar2(80), mid varchar2(80), time date , content varchar2(300), constraint predict_data primary key (id) );#字段注释comment on table predict_data is '预测表';

MSSQL创建表时添加说明

示例: IF OBJECT_ID('MemberExt1') IS NOT NULL DROP TABLE MemberExt1 GO CREATE TABLE MemberExt1 ( MemberId INT NOT NULL, QRImage NVARCHAR(500) , Url NVARCHAR(500) ) EXEC sp_addextendedproperty N'MS_Description', N'记录Member的二维码和个人推荐URL', N'user', N'dbo',

MySQL 创建表时,设置时间字段自动插入当前时间

MySQL 创建表时,设置时间字段自动插入当前时间 DROP TABLE IF EXISTS `CONTENT`; CREATE TABLE `CONTENT` ( `ID` char(20) NOT NULL, `CURRENT_TIME` timestamp not null default current_timestamp, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Oracle创建表时Storage参数具体含义

本文通过图表和实例的阐述在Oracle数据库创建新表时Storage的参数具体含义. 可用于:表空间.回滚段.表.索引.分区.快照.快照日志 参数名称 缺省值 最小值 最大值 说明 INITIAL 5(数据块) 2(数据块) 操作系统限定 分配给Segment的第一个Extent的大小,以字节为单位,这个参数不能在alter语句中改变,如果指定的值小于最小值,则按最小值创建. NEXT 5(数据块) 1(数据块) 操作系统限定 第二个Extent的大小等于NEXT的初值,以后的NEXT值=前一N

Oracle设置创建表时的默认表空间

在导入/创建Oracle数据库表,有时我们会检查发现,导入/创建后表,所创建的表空间并非是我们想要的默认表空间.此时我们需要先修改用户的默认表空间,再导入的方式来解决该问题. alter user 你的用户名 default tablespace 你想默认的表空间 例如:alter user platform default tablespace platform 执行生效后,此时,再导入脚本或者创建表,就会在指定的默认空间下了

HBase 常用java api获得客户端,创建表,查询,删除

1,前期准备 (1) 本文采用的hbase是采用三台服务器搭建的集群,zookeeper也是相同服务器搭建的集群,集群ip分别是192.168.183.101: 192.168.183.102: 192.168.183.103.其中102是主节点(HMaster),101以及103都是HRegionServer (2) 这次测试安装的hbase的版本是 hbase-0.99.2.-bin.tar (3)java api引用的maven依赖路径如下 <dependency> <groupI