望看到知道哪里出错的同志帮帮忙,谢谢大家!
报错信息如下:
java.lang.reflect.InaccessibleObjectException: Unable to make static boolean java.nio.Bits.unaligned() accessible: module java.base does not "opens java.nio" to unnamed module @19c65cdc
连接代码为:
package experiment_one;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.*;
import org.apache.hadoop.hbase.client.*;
import java.io.IOException;
import java.util.Scanner;
public class show_table_data {
public static Configuration configuration;
public static Connection connection;
public static Admin admin;
/**
* @param args
*/
//建立连接
public static void init(){
configuration = HBaseConfiguration.create();
configuration.set("hbase.rootdir","hdfs://192.168.20.110:9000/hbase");
try{
connection = ConnectionFactory.createConnection(configuration);
admin = connection.getAdmin();
}catch (IOException e){
e.printStackTrace();
}
}
//关闭连接
public static void close(){
try{
if(admin != null){
admin.close();
}
if(null != connection){
connection.close();
}
}catch (IOException e){
e.printStackTrace();
}
}
/**
* 根据表名查找表信息
*/
public static void getData(String tableName)throws IOException{
init();
Table table = connection.getTable(TableName.valueOf(tableName));
Scan scan = new Scan();
ResultScanner scanner = table.getScanner(scan);
for(Result result:scanner)
{
showCell((result));
}
close();
}
/**
* 格式化输出
* @param result
*/
public static void showCell(Result result){
Cell[] cells = result.rawCells();
for(Cell cell:cells){
System.out.println("RowName(行键):"+new String(CellUtil.cloneRow(cell))+" ");
System.out.println("Timetamp(时间戳):"+cell.getTimestamp()+" ");
System.out.println("column Family(列簇):"+new String(CellUtil.cloneFamily(cell))+" ");
System.out.println("column Name(列名):"+new String(CellUtil.cloneQualifier(cell))+" ");
System.out.println("value:(值)"+new String(CellUtil.cloneValue(cell))+" ");
System.out.println();
}
}
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
show_table_data t =new show_table_data();
System.out.println("请输入要查看的表名");
Scanner scan = new Scanner(System.in);
String tableName=scan.nextLine();
System.out.println("信息如下:");
t.getData(tableName);
}
}
有没有会的同学呀 着急,着急,着急