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 2022/02/19 03:19:24 UTC

[GitHub] [shardingsphere] human-user opened a new issue #15511: Error creating bean `ShardingSphereAutoConfiguration` , No default constructor found

human-user opened a new issue #15511:
URL: https://github.com/apache/shardingsphere/issues/15511


   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   5.0.0
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
    ShardingSphere-JDBC
   
   ### Expected behavior
   
   I have use `ApplicationContext.getBeansWithAnnotation(ComponentScan.class)`, it thows `BeanCreationException`. I want to resolve this exception.
   
   ### Actual behavior
   
   ```
   org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration$$EnhancerBySpringCGLIB$$77128f43]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration$$EnhancerBySpringCGLIB$$77128f43.<init>()
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1303)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1197)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
   	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
   	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
   	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
   	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
   	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansWithAnnotation(DefaultListableBeanFactory.java:655)
   	at org.springframework.context.support.AbstractApplicationContext.getBeansWithAnnotation(AbstractApplicationContext.java:1248)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
   	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
   	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
   	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
   	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
   	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:392)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
   	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
   	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
   	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
   	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
   	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:179)
   	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705)
   	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
   	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
   	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:743)
   	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:390)
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1214)
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1203)
   	at com.example.ms.org.starter.MsStarter.main(MsStarter.java:17)
   Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration$$EnhancerBySpringCGLIB$$77128f43]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration$$EnhancerBySpringCGLIB$$77128f43.<init>()
   	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:83)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1295)
   	... 37 more
   Caused by: java.lang.NoSuchMethodException: org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration$$EnhancerBySpringCGLIB$$77128f43.<init>()
   	at java.lang.Class.getConstructor0(Class.java:3082)
   	at java.lang.Class.getDeclaredConstructor(Class.java:2178)
   	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:78)
   	... 38 more
   ```
   
   ### Reason analyze (If you can)
   
   I think `ShardingSphereAutoConfiguration` class annotation `@RequiredArgsConstructor` should be remove, or add `@NoArgsConstructor`.
   
   ![image](https://user-images.githubusercontent.com/68408844/154783927-e321d7dd-1db3-4065-9c4d-54d41b5d9378.png)
   
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ### 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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] zjcnb commented on issue #15511: Error creating bean `ShardingSphereAutoConfiguration` , No default constructor found

Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #15511:
URL: https://github.com/apache/shardingsphere/issues/15511#issuecomment-1046784430


   @human-user Does it affect normal use if remove `@RequiredArgsConstructor` ?


-- 
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] human-user commented on issue #15511: Error creating bean `ShardingSphereAutoConfiguration` , No default constructor found

Posted by GitBox <gi...@apache.org>.
human-user commented on issue #15511:
URL: https://github.com/apache/shardingsphere/issues/15511#issuecomment-1047494281


   @zjcnb ,It not work well if only remove `@RequiredArgsConstructor`,maybe do like this:
   
   ![image](https://user-images.githubusercontent.com/68408844/155081875-9880fc30-bcc3-4ba0-be12-e1d59e9ebe5e.png)
   


-- 
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] human-user edited a comment on issue #15511: Error creating bean `ShardingSphereAutoConfiguration` , No default constructor found

Posted by GitBox <gi...@apache.org>.
human-user edited a comment on issue #15511:
URL: https://github.com/apache/shardingsphere/issues/15511#issuecomment-1047494281


   @zjcnb ,It not work well if only remove `@RequiredArgsConstructor`,maybe do like this:
   
   ![image](https://user-images.githubusercontent.com/68408844/155081875-9880fc30-bcc3-4ba0-be12-e1d59e9ebe5e.png)
   
   Is there any other way to deal it? Because i think adjust `@RequiredArgsConstructor` not a good idea.


-- 
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