---
title: 常见问题-V3.1.5-OceanBase 数据库文档-分布式数据库使用文档
description: 分布式数据库OceanBase 社区版文档中心，提供关于常见问题的相关内容，方便用户更好的应用分布式数据库OceanBaseOceanBase 数据库
image: https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*OSPzQ6GUQF4AAAAAQHAAAAgAeiGDAQ/original
---
[OceanBase AI 数据大会](https://www.oceanbase.com/conference2026 "OceanBase AI 数据大会")文档反馈![](https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*P8CuR4UJ_FkAAAAAAAAAAAAADiGDAQ/original) OceanBase 数据库分布式版 - V 3.1.5 社区版

# 常见问题

更新时间：2026-05-06 19:45:40

[编辑](https://github.com/oceanbase/oceanbase-doc/edit/V3.1.5/zh-CN/1800.supporting-tools/600.tableapi/300.faq.md)  

本文介绍了 TableAPI 使用过程中可能遇到的一些常见问题及相关的原因和解决方法。

## 使用 IDEA 开发工具常见问题

### ObTableClient Jar 包缺失

```unknow
Exception in thread "main" java.lang.NoClassDefFoundError: com/alipay/oceanbase/rpc/ObTableClient
 at com.oceanbase.example.KVClient.initial(KVClient.java:46)
 at com.oceanbase.example.SimpleKVDemo.main(SimpleKVDemo.java:25)
Caused by: java.lang.ClassNotFoundException: com.alipay.oceanbase.rpc.ObTableClient
 at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
 ... 2 more

Process finished with exit code 1

```

- 原因

  项目 `pom.xml` 文件指定的 `obkv-table-client` 依赖包缺失，可能原因是没有被下载到本地 mvn 仓库。客户端 jar 包的完整路径为：

  ```unknow
  ～/.m2/repository/com/oceanbase/obkv-table-client/0.1.0/obkv-table-client-0.1.0.jar

  ```
 - 解决方案

  您可依照下图确认 IDEA 开发工具中是否配置了 Local repository 本地仓库地址。

  ![IDEA 开发工具](https://help-static-aliyun-doc.aliyuncs.com/assets/img/zh-CN/8068330461/p374548.png)

### 初始化 Java Client 失败

```unknow
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Sofa-Middleware-Log:WARN [oceanbase-table-client] No log util is usable, Default app logger will be used.
... ...
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'proxyro'@'xxx.xxx.xxx.xxx' (using password: YES)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  ... ...

```

- 原因

  示例中没有设置 proxyro 用户密码，即在客户端初始化时，`setSysUserName` 函数指定的用户中没有设置密码。

  ```unknow
  obTableClient.setSysUserName("proxyro@sys"); // e.g. proxyro@sys
  obTableClient.setSysPassword("proxyro@passwd");

  您可使用 obclient 或 MySQL 客户端登录 OceanBase，具体方法可参考 [通过 obclient 连接 OceanBase 租户](https://www.oceanbase.com/docs/community-observer-cn-10000000001879104) 和 [通过 MySQL 客户端连接 OceanBase 数据库](https://www.oceanbase.com/docs/community-observer-cn-10000000001879103)。

  ```unknow
  grant select on oceanbase.* to proxyro identified by 'xxx';
  // 'xxx' 为设置的密码，您可自由设置

  ```

### database empty 错误

```unknow
java.lang.IllegalArgumentException: database is empty. url=http://ip:port/services?Action=ObRootServiceInfo&User_ID=admin&UID=admin&ObRegion=ocp
 at com.alipay.oceanbase.rpc.ObTableClient.setParamURL(ObTableClient.java:1396)
 at com.oceanbase.example.KVClient.initial(KVClient.java:48)
 at com.oceanbase.example.SimpleKVDemo.main(SimpleKVDemo.java:25)
fail to init KV client, java.lang.IllegalArgumentException: database is empty. url=http://ip:port/services?Action=ObRootServiceInfo&User_ID=admin&UID=admin&ObRegion=ocp

```

- 原因

  在初始化 Java 客户端时，没有在 `setParamURL` 函数的输入 URL 中指定 database。
 - 解决方案

  您可在 URL 中指定需要访问的 database。

  ```unknow
  obTableClient.setParamURL("http://ip:port/services?Action=ObRootServiceInfo&User_ID=xxx&UID=xxx&ObRegion=xxx&database=test");

  ```

### table not exist 错误

```unknow
com.alipay.oceanbase.rpc.exception.ObTableNotExistException: table not exist: kv_table
 at com.alipay.oceanbase.rpc.location.LocationUtil.getTableEntryFromResultSet(LocationUtil.java:622)
 at com.alipay.oceanbase.rpc.location.LocationUtil.getTableEntryFromRemote(LocationUtil.java:384)
 at com.alipay.oceanbase.rpc.location.LocationUtil.access$200(LocationUtil.java:50)
 at com.alipay.oceanbase.rpc.location.LocationUtil$1$1.execute(LocationUtil.java:313)
 at com.alipay.oceanbase.rpc.location.LocationUtil$1$1.execute(LocationUtil.java:309)
 at com.alipay.oceanbase.rpc.location.LocationUtil.callTableEntryRefresh(LocationUtil.java:264)
 at com.alipay.oceanbase.rpc.location.LocationUtil.access$300(LocationUtil.java:50)
 at com.alipay.oceanbase.rpc.location.LocationUtil$1.execute(LocationUtil.java:308)
 at com.alipay.oceanbase.rpc.location.LocationUtil$1.execute(LocationUtil.java:305)
 at com.alipay.oceanbase.rpc.location.LocationUtil.callTableEntryRefreshWithPriority(LocationUtil.java:133)
 at com.alipay.oceanbase.rpc.location.LocationUtil.loadTableEntryWithPriority(LocationUtil.java:304)
 at com.alipay.oceanbase.rpc.ObTableClient.refreshTableEntry(ObTableClient.java:753)
 at com.alipay.oceanbase.rpc.ObTableClient.getOrRefreshTableEntry(ObTableClient.java:702)
 at com.alipay.oceanbase.rpc.ObTableClient.getTable(ObTableClient.java:839)
 at com.alipay.oceanbase.rpc.ObTableClient.execute(ObTableClient.java:424)
 at com.alipay.oceanbase.rpc.ObTableClient.execute(ObTableClient.java:400)
 at com.alipay.oceanbase.rpc.ObTableClient.insert(ObTableClient.java:1060)
 at com.alipay.oceanbase.rpc.table.AbstractTable.insert(AbstractTable.java:52)
 at com.oceanbase.example.KVClient.put(KVClient.java:81)
 at com.oceanbase.example.SimpleKVDemo.main(SimpleKVDemo.java:40)
fail to put kv data, com.alipay.oceanbase.rpc.exception.ObTableNotExistException: table not exist: kv_table

```

- 原因

  客户端 setParamURL 的 database 中 `kv_table` 表不存在。

  > **注意**
  >
  >  
  >
  > kv_table 是示例中报错的表名，仅供参考，具体要以实际为准。
 - 解决方案

  保证 setParamURL 指定的 database 中，必须要有客户端接口操作的 table。

## 使用命令行开发常见问题

### 找不到 sofa 等依赖包

```unknow
$mvn compile -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building simple-kv-demo 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.oceanbase:obkv-table-client:jar:0.1.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ simple-kv-demo ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/admin/github/obkv-table-client-java/example/simple-kv-demo/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ simple-kv-demo ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 3 source files to /home/admin/github/obkv-table-client-java/example/simple-kv-demo/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/admin/github/obkv-table-client-java/example/simple-kv-demo/src/main/java/com/oceanbase/example/LoggerFactory.java:[21,35] package com.alipay.sofa.common.code does not exist
[ERROR] /home/admin/github/obkv-table-client-java/example/simple-kv-demo/src/main/java/com/oceanbase/example/LoggerFactory.java:[22,34] package com.alipay.sofa.common.log does not exist
[ERROR] /home/admin/github/obkv-table-client-java/example/simple-kv-demo/src/main/java/com/oceanbase/example/LoggerFactory.java:[23,17] package org.slf4j does not exist
[ERROR] /home/admin/github/obkv-table-client-java/example/simple-kv-demo/src/main/java/com/oceanbase/example/LoggerFactory.java:[28,19] cannot find symbol
  symbol:   class LogCode2Description
  location: class com.oceanbase.example.LoggerFactory
[ERROR] /home/admin/github/obkv-table-client-java/example/simple-kv-demo/src/main/java/com/oceanbase/example/LoggerFactory.java:[31,19] cannot find symbol
  symbol:   class Logger
  location: class com.oceanbase.example.LoggerFactory
[ERROR] /home/admin/github/obkv-table-client-java/example/simple-kv-demo/src/main/java/com/oceanbase/example/LoggerFactory.java:[38,19] cannot find symbol
  symbol:   class Logger
  location: class com.oceanbase.example.LoggerFactory
[ERROR] /home/admin/github/obkv-table-client-java/example/simple-kv-demo/src/main/java/com/oceanbase/example/LoggerFactory.java:[28,45] cannot find symbol
  symbol:   variable LogCode2Description
  location: class com.oceanbase.example.LoggerFactory
[ERROR] /home/admin/github/obkv-table-client-java/example/simple-kv-demo/src/main/java/com/oceanbase/example/LoggerFactory.java:[35,16] cannot find symbol
  symbol:   variable LoggerSpaceManager
  location: class com.oceanbase.example.LoggerFactory

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project simple-kv-demo: Compilation failure
    at org.apache.maven.lifecycle.internal.MojoE

```

- 原因

  可能是 `pom.xml` 依赖项所依赖的 jar 包在本地路径上不是最新版本。
 - 解决方案

  您可清理项目依赖的本地 mvn 仓库包，并重新编译。

  ```unknow
  mvn dependency:purge-local-repository

  ```

## 注意事项

如果您是直接使用 github 官网上的 demo 进行调测，请把 demo 项目的所有依赖打包后再执行，全依赖打包需要修改 demo 的 `pom.xml` 文件。 以 `obkv-table-client-java/example/simple-kv-demo` 为例，添加如下内容到 `pom.xml`：

```unknow
<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>com.oceanbase.example.SimpleKVDemo</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
          <goals>
            <goal>single</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

```

修改后重新编包：

```unknow
mvn clean package

```

最后执行：

```unknow
java -cp ./target/simple-kv-demo-1.0-SNAPSHOT-jar-with-dependencies.jar com.oceanbase.example.SimpleKVDemo

```

> **说明**
>
>  
>
> 客户端使用参考 Demo 可访问 [example](https://github.com/oceanbase/obkv-table-client-java/tree/master/example) 查看。

 上一篇 下一篇 ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ) 咨询
