Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fix clickhouse with druid #566

Merged
merged 25 commits into from
Jun 30, 2023
Merged

Feature/fix clickhouse with druid #566

merged 25 commits into from
Jun 30, 2023

Conversation

gzlicanyi
Copy link
Contributor

Fix

  • Add a unit test to verify that the fix works.
  • Explain briefly why the bug exists and how to fix it.
  • Update the CHANGES log.

problem

ERROR 2023-06-30 17:42:43.351 main StaticMethodsInter : class[class com.alibaba.druid.stat.DruidDataSourceStatManager] after static method[addDataSource] intercept failure:null 
java.lang.NullPointerException
        at org.apache.skywalking.apm.plugin.jdbc.connectionurl.parser.URLParser.parser(URLParser.java:61)
        at org.apache.skywalking.apm.plugin.druid.v1.PoolingAddDruidDataSourceInterceptor.afterMethod(PoolingAddDruidDataSourceInterceptor.java:47)
        at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsInter.intercept(StaticMethodsInter.java:94)
        at com.alibaba.druid.stat.DruidDataSourceStatManager.addDataSource(DruidDataSourceStatManager.java)
        at com.alibaba.druid.pool.DruidDataSource$1.run(DruidDataSource.java:1395)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.alibaba.druid.pool.DruidDataSource.registerMbean(DruidDataSource.java:1391)
        at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:654)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Steps to reproduce

Using the following dependencies:

<dependency>
    <groupId>ru.yandex.clickhouse</groupId>
    <artifactId>clickhouse-jdbc</artifactId>
    <version>0.3.1</version>
</dependency>
<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>druid</artifactId>
    <version>1.0.16</version>
</dependency>

properties:

ck.driverClassName=ru.yandex.clickhouse.ClickHouseDriver
ck.url=jdbc:clickhouse://localhost:8321/test?socket_timeout=120000
ck.username=xxx
ck.password=xxx

spring config:

<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
          init-method="init" destroy-method="close">
        <property name="url" value="${ck.url}"/>
        <property name="username" value="${ck.username}"/>
        <property name="password" value="${ck.password}"/>
        <property name="driverClassName" value="${ck.driverClassName}"/>
    </bean>

Causes

The URLParser.parser() method in the PoolingAddDruidDataSourceInterceptor class does not support parsing ClickHouse URLs.

how to fix it

Add ClickHouse parsing to the jdbc-common plugin.

gzlicanyi and others added 25 commits May 26, 2023 16:53
@wu-sheng wu-sheng added bug Something isn't working plugin labels Jun 30, 2023
@wu-sheng wu-sheng added this to the 9.0.0 milestone Jun 30, 2023
@wu-sheng
Copy link
Member

It is better you could rebase your commits. They are too long.

@gzlicanyi
Copy link
Contributor Author

It is better you could rebase your commits. They are too long.

ok, I will do it next time.

@wu-sheng wu-sheng merged commit 7005f2d into apache:main Jun 30, 2023
@gzlicanyi gzlicanyi deleted the feature/fix-clickhouse-with-druid branch July 3, 2023 06:59
yangyulely pushed a commit to yangyulely/skywalking-java that referenced this pull request May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants