taosdata / taosdata/TDengine

driver fails to initialize when running as a bundle in an OSGi environment

Open
#25,328 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C
Stars
25.1k
Forks
5k
Avg merge
4d 59m
Merged PRs (30d)
7

Description

Bug Description
在正常的Java程序中使用taos的JDBC驱动没有问题。
但是在OSGI环境下,以Bundle形式运行的程序中,taos的JDBC驱动在类加载的过程中失败。

原因分析:
在AbstractDatabaseMetaData初始化过程中,要读取jar包根目录下的taos-jdbc-version.properties文件,
在OSGI环境下调试变量值如下,导致if分支无法进入:
屏幕截图 2024-04-10 173029

最终报错:
屏幕截图 2024-04-10 172818

请看看是否可以调整读取配置文件的方式,可以同时支持OSGI Bundle运行场景。

JDBC驱动:
com.taosdata.jdbc
taos-jdbcdriver
3.2.9

TDengine版本:3.2.3.0

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Type in '....'
  3. See error

Expected Behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [e.g. CentOS 7.0]
  • Memory, CPU, current Disk Space
  • TDengine Version [3.2.3.0]

Additional Context
Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting AbstractDatabaseMetaData initialization and how it reads taos-jdbc-version.properties from the JAR root. Reproduce the JDBC driver startup in an OSGi Bundle using the reported taos-jdbcdriver 3.2.9 and TDengine 3.2.3.0 environment. Done means the driver initializes successfully in OSGi while continuing to work in a normal Java program.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.