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 2020/12/01 03:10:45 UTC

[GitHub] [shardingsphere] xianzhuo-sky opened a new issue #8431: NullPointerException when spring boot startup

xianzhuo-sky opened a new issue #8431:
URL: https://github.com/apache/shardingsphere/issues/8431


   ## Bug Report
   
   **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/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/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 ShardingSphere did you use?
   5.0.0-alpha
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   shardingsphere-jdbc-core-spring-namespace
   
   ### Expected behavior
   
   ### Actual behavior
   `2020-12-01 10:58:58.485 ERROR 10352 --- [           main] o.s.boot.SpringApplication               : Application run failed
   
   org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [file:/C:/Users/%e5%88%98%e6%98%be%e5%8d%93/IdeaProjects/device-diagnosis/device-diagnosis-api/target/classes/sharding-jdbc.xml]; nested exception is java.lang.NullPointerException
   	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:417) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:338) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:195) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromImportedResources$0(ConfigurationClassBeanDefinitionReader.java:378) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[na:na]
   	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromImportedResources(ConfigurationClassBeanDefinitionReader.java:345) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:147) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:120) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:331) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:280) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533) ~[spring-context-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.5.RELEASE.jar:2.3.5.RELEASE]
   	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.5.RELEASE.jar:2.3.5.RELEASE]
   	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.5.RELEASE.jar:2.3.5.RELEASE]
   	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405) ~[spring-boot-2.3.5.RELEASE.jar:2.3.5.RELEASE]
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.5.RELEASE.jar:2.3.5.RELEASE]
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.5.RELEASE.jar:2.3.5.RELEASE]
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.5.RELEASE.jar:2.3.5.RELEASE]
   	at com.bjxindun.dd.Application.main(Application.java:15) ~[classes/:na]
   Caused by: java.lang.NullPointerException: null
   	at org.apache.shardingsphere.spring.namespace.registry.ShardingSphereAlgorithmBeanRegistry.getAlgorithmBeanReferences(ShardingSphereAlgorithmBeanRegistry.java:48) ~[shardingsphere-jdbc-spring-namespace-infra-5.0.0-alpha.jar:5.0.0-alpha]
   	at org.apache.shardingsphere.sharding.spring.namespace.parser.rule.ShardingRuleBeanDefinitionParser.parseInternal(ShardingRuleBeanDefinitionParser.java:57) ~[shardingsphere-sharding-spring-namespace-5.0.0-alpha.jar:5.0.0-alpha]
   	at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:63) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1391) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1371) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:179) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:149) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:96) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:511) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391) ~[spring-beans-5.2.10.RELEASE.jar:5.2.10.RELEASE]
   	... 24 common frames omitted`
   ### Reason analyze (If you can)
   
   org.apache.shardingsphere.spring.namespace.registry.ShardingSphereAlgorithmBeanRegistry.getAlgorithmBeanReferences(ShardingSphereAlgorithmBeanRegistry.java:48)
   
   parserContext.getRegistry().getBeanDefinition(each).getBeanClassName() without null check
   
   ### 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.

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



[GitHub] [shardingsphere] xianzhuo-sky commented on issue #8431: NullPointerException when spring boot startup

Posted by GitBox <gi...@apache.org>.
xianzhuo-sky commented on issue #8431:
URL: https://github.com/apache/shardingsphere/issues/8431#issuecomment-736203231


   need a fix


----------------------------------------------------------------
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] tuohai666 commented on issue #8431: NullPointerException when spring boot startup

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


   @xianzhuo-sky Can you submit a pull request?


----------------------------------------------------------------
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] casxter edited a comment on issue #8431: NullPointerException when spring boot startup

Posted by GitBox <gi...@apache.org>.
casxter edited a comment on issue #8431:
URL: https://github.com/apache/shardingsphere/issues/8431#issuecomment-849381848


   > @xianzhuo-sky
   > Hi ,can you show you XML .
   > 
   > this code , When is null returned?
   > 
   > ```
   > parserContext.getRegistry().getBeanDefinition(each).getBeanClassName()
   > ```
   
   ![image](https://user-images.githubusercontent.com/11751101/119779878-be144400-befb-11eb-8d7b-6d89d34d8c79.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.

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



[GitHub] [shardingsphere] yu199195 commented on issue #8431: NullPointerException when spring boot startup

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


   @xianzhuo-sky  
   Hi ,can you show you XML . 
   
   
   this code , When is null returned?
   
   ```
   parserContext.getRegistry().getBeanDefinition(each).getBeanClassName()
   ```
   
   
   


----------------------------------------------------------------
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] xianzhuo-sky edited a comment on issue #8431: NullPointerException when spring boot startup

Posted by GitBox <gi...@apache.org>.
xianzhuo-sky edited a comment on issue #8431:
URL: https://github.com/apache/shardingsphere/issues/8431#issuecomment-736203231


   need a fix  in master branch ,  I didn't pull request


----------------------------------------------------------------
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] casxter commented on issue #8431: NullPointerException when spring boot startup

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


   > @xianzhuo-sky
   > Hi ,can you show you XML .
   > 
   > this code , When is null returned?
   > 
   > ```
   > parserContext.getRegistry().getBeanDefinition(each).getBeanClassName()
   > ```
   
   ![Uploading image.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.

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



[GitHub] [shardingsphere] terrymanu closed issue #8431: NullPointerException when spring boot startup

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #8431:
URL: https://github.com/apache/shardingsphere/issues/8431


   


-- 
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] tristaZero commented on issue #8431: NullPointerException when spring boot startup

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


   @xianzhuo-sky If you have located the bug, we welcome your interaction with the community If you like. :)
   FYI, [How to raise a PR](https://shardingsphere.apache.org/community/cn/contribute/contributor/).


----------------------------------------------------------------
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] tristaZero commented on issue #8431: NullPointerException when spring boot startup

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


   Hi @xianzhuo-sky ,
   Do you think [examples](https://github.com/apache/shardingsphere/tree/5.0.0-alpha/examples/shardingsphere-jdbc-example/sharding-example) can give you some points?


----------------------------------------------------------------
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] xianzhuo-sky closed issue #8431: NullPointerException when spring boot startup

Posted by GitBox <gi...@apache.org>.
xianzhuo-sky closed issue #8431:
URL: https://github.com/apache/shardingsphere/issues/8431


   


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