gpt4 book ai didi

java - 从java连接hbase时出错

转载 作者:太空宇宙 更新时间:2023-11-04 07:27:30 25 4
gpt4 key购买 nike

我尝试从java以本地模式连接HBase,但在调试时报告错误。我的代码:

import java.io.IOException;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.conf.Configuration;


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

Configuration config = HBaseConfiguration.create();
HTable table = new HTable(config, "test");
....

和错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.hadoop.conf.Configuration.<clinit>(Configuration.java:129)
at mylittlehbaseclient.MyLittleHBaseClient.main(MyLittleHBaseClient.java:32)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

最佳答案

您需要commons-logging项目类路径中的库。

关于java - 从java连接hbase时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18299332/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com