gzlicanyi opened a new pull request, #566:
URL: https://github.com/apache/skywalking-java/pull/566
<!--
⚠️ Please make sure to read this template first, pull requests that
don't accord with this template
maybe closed without notice.
Texts surrounded by `<` and `>` are meant to be replaced by you, e.g.
<framework name>, <issue number>.
Put an `x` in the `[ ]` to mark the item as CHECKED. `[x]`
-->
### Fix <bug description or the bug issue number or bug issue link>
- [x] Add a unit test to verify that the fix works.
- [x] Explain briefly why the bug exists and how to fix it.
- [x] Update the [`CHANGES`
log](https://github.com/apache/skywalking-java/blob/main/CHANGES.md).
### problem
```java
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:
```xml
<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:
```xml
<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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]