You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/01/01 14:20:22 UTC
[GitHub] [shardingsphere-elasticjob] wenlincheng opened a new issue #1799: NoSuchMethodException: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper.()
wenlincheng opened a new issue #1799:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1799
## Bug Report
When init data source, the DruidDataSourceWrapper can not find the Init function.
version:
- elasticjob-lite-spring-boot-starter 3.0.0-RC1
- springboot 2.3.2
- druid-starter 1.1.20
`
2021-01-01 22:13:10.923 ERROR 26227 -- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.shardingsphere.elasticjob.lite.spring.boot.job.ElasticJobBootstrapConfiguration': Invocation of init method failed; nested exception is java.lang.NoSuchMethodException: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper.<init>()
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:160)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:415)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207)
at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:241)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:723)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:536)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140)
at com.wenlincheng.pika.schedule.PikaScheduleApplication.main(PikaScheduleApplication.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.NoSuchMethodException: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.getConstructor(Class.java:1825)
at org.apache.shardingsphere.elasticjob.tracing.rdb.datasource.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:113)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
at org.apache.shardingsphere.elasticjob.tracing.rdb.datasource.DataSourceRegistry.getDataSource(DataSourceRegistry.java:61)
at org.apache.shardingsphere.elasticjob.tracing.rdb.datasource.DataSourceConfiguration.getStorage(DataSourceConfiguration.java:102)
at org.apache.shardingsphere.elasticjob.tracing.rdb.datasource.DataSourceConfiguration.getStorage(DataSourceConfiguration.java:43)
at org.apache.shardingsphere.elasticjob.tracing.listener.TracingListenerFactory.getListener(TracingListenerFactory.java:56)
at org.apache.shardingsphere.elasticjob.tracing.JobTracingEventBus.register(JobTracingEventBus.java:67)
at org.apache.shardingsphere.elasticjob.tracing.JobTracingEventBus.<init>(JobTracingEventBus.java:55)
at org.apache.shardingsphere.elasticjob.lite.internal.schedule.LiteJobFacade.<init>(LiteJobFacade.java:71)
at org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduler.<init>(JobScheduler.java:86)
at org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap.<init>(ScheduleJobBootstrap.java:36)
at org.apache.shardingsphere.elasticjob.lite.spring.boot.job.ElasticJobBootstrapConfiguration.registerClassedJob(ElasticJobBootstrapConfiguration.java:101)
at org.apache.shardingsphere.elasticjob.lite.spring.boot.job.ElasticJobBootstrapConfiguration.constructJobBootstraps(ElasticJobBootstrapConfiguration.java:84)
at org.apache.shardingsphere.elasticjob.lite.spring.boot.job.ElasticJobBootstrapConfiguration.createJobBootstrapBeans(ElasticJobBootstrapConfiguration.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157)
... 23 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:52855', transport: 'socket'
Process finished with exit code 0
`
**For English only**, other languages will not accept.
Before report a bug, make sure you have:
- Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere-elasticjob/issues).
- Read documentation: [ElasticJob Doc](https://shardingsphere.apache.org/elasticjob/current/en/overview/).
Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will **close it**.
Please answer these questions before submitting your issue. Thanks!
### Which version of ElasticJob did you use?
### Which project did you use? ElasticJob-Lite or ElasticJob-Cloud?
### Expected behavior
### Actual behavior
### Reason analyze (If you can)
### Steps to reproduce the behavior.
### Example codes for reproduce this issue (such as a github link).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] 768179367 commented on issue #1799: NoSuchMethodException: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper.()
Posted by GitBox <gi...@apache.org>.
768179367 commented on issue #1799:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1799#issuecomment-1008484835
hello, you can register a bean of TracingConfiguration<DataSource> to cover default DruidDataSourceWrapper
` @Bean
public TracingConfiguration<DataSource> tracingConfiguration(final DataSource dataSource) {
String className = "com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper";
if (dataSource.getClass().getName().equals(className)) {
DruidDataSource originDataSource = (DruidDataSource) dataSource;
DruidDataSource selfDatasource = new DruidDataSource();
// set you datasource config
selfDatasource.setDriver(originDataSource.getDriver());
selfDatasource.setUrl(originDataSource.getUrl());
selfDatasource.setUsername(originDataSource.getUsername());
selfDatasource.setPassword(originDataSource.getPassword());
return new TracingConfiguration<>(RDB, selfDatasource);
}
return new TracingConfiguration<>(RDB, dataSource);
}`
and ### do not have any config in `application.yml` about tarcing.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] tenoi commented on issue #1799: NoSuchMethodException: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper.()
Posted by GitBox <gi...@apache.org>.
tenoi commented on issue #1799:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1799#issuecomment-1019538468
https://github.com/alibaba/druid/issues/4481
更新版本到1.2.8
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] TeslaCN commented on issue #1799: NoSuchMethodException: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper.()
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #1799:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1799#issuecomment-753736874
We didn't take the wrapper class without public no args constructor into consideration before. Do you have any ideas about this issue?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] folochina commented on issue #1799: NoSuchMethodException: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper.()
Posted by GitBox <gi...@apache.org>.
folochina commented on issue #1799:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1799#issuecomment-919677200
> 您可以尝试注册一个 TracingConfiguration<DataSource> bean 来覆盖默认值, `DruidDataSourceWrapper` 如下所示:
>
> ```
> import org.apache.commons.dbcp2.BasicDataSource;
>
> @Setter
> @Configuration
> @ConfigurationProperties(prefix = "elasticjob.tracing.datasource")
> public class ElasticJobTracingConfiguration {
>
> private String driverClassName;
>
> private String url;
>
> private String username;
>
> private String password;
>
> @Bean
> public TracingConfiguration<DataSource> myTracingConfiguration() {
> BasicDataSource dataSource = new BasicDataSource();
> dataSource.setDriverClassName(driverClassName);
> dataSource.setUrl(url);
> dataSource.setUsername(username);
> dataSource.setPassword(password);
> return new TracingConfiguration<>("RDB", dataSource);
> }
>
> }
> ```
>
> 和
>
> 在 `application.yml`
>
> ```
> elasticjob:
> tracing:
> datasource:
> driverClassName: com.mysql.jdbc.Driver
> url: jdbc:mysql://xxxx/databases?useUnicode=true&characterEncoding=UTF-8&useSSL=false
> username: root
> password: xxxx
> ```
尝试了这个方案,发现无效
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] TeslaCN edited a comment on issue #1799: NoSuchMethodException: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper.()
Posted by GitBox <gi...@apache.org>.
TeslaCN edited a comment on issue #1799:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1799#issuecomment-753736874
Hi @wenlincheng
We didn't take the wrapper class without public no args constructor into consideration before. Do you have any ideas about this issue?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] sandyisone commented on issue #1799: NoSuchMethodException: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper.()
Posted by GitBox <gi...@apache.org>.
sandyisone commented on issue #1799:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1799#issuecomment-845615821
有解决吗?
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] 768179367 edited a comment on issue #1799: NoSuchMethodException: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper.()
Posted by GitBox <gi...@apache.org>.
768179367 edited a comment on issue #1799:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1799#issuecomment-1008484835
hello, you can register a bean of TracingConfiguration<DataSource> to cover default DruidDataSourceWrapper
```java
@Bean
public TracingConfiguration<DataSource> tracingConfiguration(final DataSource dataSource) {
String className = "com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper";
if (dataSource.getClass().getName().equals(className)) {
DruidDataSource originDataSource = (DruidDataSource) dataSource;
DruidDataSource selfDatasource = new DruidDataSource();
// set you datasource config
selfDatasource.setDriver(originDataSource.getDriver());
selfDatasource.setUrl(originDataSource.getUrl());
selfDatasource.setUsername(originDataSource.getUsername());
selfDatasource.setPassword(originDataSource.getPassword());
return new TracingConfiguration<>(RDB, selfDatasource);
}
return new TracingConfiguration<>(RDB, dataSource);
}
```
and do not have any config in `application.yml` about tarcing.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] skaic commented on issue #1799: NoSuchMethodException: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper.()
Posted by GitBox <gi...@apache.org>.
skaic commented on issue #1799:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1799#issuecomment-845819552
you can try register a bean of TracingConfiguration\<DataSource\> to cover default `DruidDataSourceWrapper` like this:
```
@Setter
@Configuration
@ConfigurationProperties(prefix = "elasticjob.tracing.datasource")
public class ElasticJobTracingConfiguration {
private String driverClassName;
private String url;
private String username;
private String password;
@Bean
public TracingConfiguration<DataSource> myTracingConfiguration() {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(driverClassName);
dataSource.setUrl(url);
dataSource.setUsername(username);
dataSource.setPassword(password);
return new TracingConfiguration<>("RDB", dataSource);
}
}
```
and
in `application.yml`
```
elasticjob:
tracing:
datasource:
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://xxxx/databases?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: xxxx
```
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] skaic edited a comment on issue #1799: NoSuchMethodException: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper.()
Posted by GitBox <gi...@apache.org>.
skaic edited a comment on issue #1799:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1799#issuecomment-845819552
you can try register a bean of TracingConfiguration\<DataSource\> to cover default `DruidDataSourceWrapper` like this:
```
import org.apache.commons.dbcp2.BasicDataSource;
@Setter
@Configuration
@ConfigurationProperties(prefix = "elasticjob.tracing.datasource")
public class ElasticJobTracingConfiguration {
private String driverClassName;
private String url;
private String username;
private String password;
@Bean
public TracingConfiguration<DataSource> myTracingConfiguration() {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(driverClassName);
dataSource.setUrl(url);
dataSource.setUsername(username);
dataSource.setPassword(password);
return new TracingConfiguration<>("RDB", dataSource);
}
}
```
and
in `application.yml`
```
elasticjob:
tracing:
datasource:
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://xxxx/databases?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: xxxx
```
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere-elasticjob] folochina commented on issue #1799: NoSuchMethodException: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceWrapper.()
Posted by GitBox <gi...@apache.org>.
folochina commented on issue #1799:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1799#issuecomment-919671580
同样问题
- elasticjob-lite-spring-boot-starter 3.0.0
- springboot 2.3.2.RELEASE
- druid-starter 1.2.6
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org