[jira] [Commented] (SCB-737) avoid null point exception
[ https://issues.apache.org/jira/browse/SCB-737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16646266#comment-16646266 ] ASF GitHub Bot commented on SCB-737: liubao68 closed pull request #936: [SCB-737]Avoid null point exception URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/936 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/providers/provider-pojo/src/main/java/org/apache/servicecomb/provider/pojo/schema/PojoProducers.java b/providers/provider-pojo/src/main/java/org/apache/servicecomb/provider/pojo/schema/PojoProducers.java index 4e0e3619d..b173ead65 100644 --- a/providers/provider-pojo/src/main/java/org/apache/servicecomb/provider/pojo/schema/PojoProducers.java +++ b/providers/provider-pojo/src/main/java/org/apache/servicecomb/provider/pojo/schema/PojoProducers.java @@ -63,6 +63,9 @@ protected void processProvider(String beanName, Object bean) { // aop后,新的实例的父类可能是原class,也可能只是个proxy,父类不是原class // 所以,需要先取出原class,再取标注 Class beanCls = BeanUtils.getImplClassFromBean(bean); +if(beanCls == null) { + return; +} RpcSchema rpcSchema = beanCls.getAnnotation(RpcSchema.class); if (rpcSchema == null) { return; diff --git a/providers/provider-rest-common/src/main/java/org/apache/servicecomb/provider/rest/common/RestProducers.java b/providers/provider-rest-common/src/main/java/org/apache/servicecomb/provider/rest/common/RestProducers.java index 5adedfe50..8fac2e201 100644 --- a/providers/provider-rest-common/src/main/java/org/apache/servicecomb/provider/rest/common/RestProducers.java +++ b/providers/provider-rest-common/src/main/java/org/apache/servicecomb/provider/rest/common/RestProducers.java @@ -49,6 +49,9 @@ protected void processProvider(String beanName, Object bean) { // aop后,新的实例的父类可能是原class,也可能只是个proxy,父类不是原class // 所以,需要先取出原class,再取标注 Class beanCls = BeanUtils.getImplClassFromBean(bean); +if(beanCls == null) { + return; +} RestSchema restSchema = beanCls.getAnnotation(RestSchema.class); if (restSchema == null) { return; This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > avoid null point exception > -- > > Key: SCB-737 > URL: https://issues.apache.org/jira/browse/SCB-737 > Project: Apache ServiceComb > Issue Type: Task >Reporter: laijianbin >Assignee: laijianbin >Priority: Major > > 2018-07-11 > 03:27:52,651Z(28241):ERROR{}[main]org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:771)-->Application > startup failed > org.springframework.beans.factory.UnsatisfiedDependencyException: Error > creating bean with name 'batchConfig': Unsatisfied dependency expressed > through field 'jobBuilderFactory'; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'jobBuilders' defined in class path resource > [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: > Bean instantiation via factory method failed; nested exception is > org.springframework.beans.BeanInstantiationException: Failed to instantiate > [org.springframework.batch.core.configuration.annotation.JobBuilderFactory]: > Factory method 'jobBuilders' threw exception; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'jobRepository' defined in class path resource > [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: > Initialization of bean failed; nested exception is > java.lang.NullPointerException > > RELEASE] > at > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at
[jira] [Commented] (SCB-737) avoid null point exception
[ https://issues.apache.org/jira/browse/SCB-737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16644823#comment-16644823 ] ASF GitHub Bot commented on SCB-737: liubao68 commented on a change in pull request #936: [SCB-737]Avoid null point exception URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/936#discussion_r224030028 ## File path: providers/provider-pojo/src/main/java/org/apache/servicecomb/provider/pojo/schema/PojoProducers.java ## @@ -63,6 +63,9 @@ protected void processProvider(String beanName, Object bean) { // aop后,新的实例的父类可能是原class,也可能只是个proxy,父类不是原class // 所以,需要先取出原class,再取标注 Class beanCls = BeanUtils.getImplClassFromBean(bean); +if(beanCls == null) { Review comment: OK, fine. When users defined bean using EnableBatchProcessing, they will not set bean implementation class. So beans annotated with @RestSchema should not do this. In this situation, I think we do not need add a log just like we do not add a log for others beans not annotated with @RestSchema This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > avoid null point exception > -- > > Key: SCB-737 > URL: https://issues.apache.org/jira/browse/SCB-737 > Project: Apache ServiceComb > Issue Type: Task >Reporter: laijianbin >Assignee: laijianbin >Priority: Major > > 2018-07-11 > 03:27:52,651Z(28241):ERROR{}[main]org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:771)-->Application > startup failed > org.springframework.beans.factory.UnsatisfiedDependencyException: Error > creating bean with name 'batchConfig': Unsatisfied dependency expressed > through field 'jobBuilderFactory'; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'jobBuilders' defined in class path resource > [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: > Bean instantiation via factory method failed; nested exception is > org.springframework.beans.BeanInstantiationException: Failed to instantiate > [org.springframework.batch.core.configuration.annotation.JobBuilderFactory]: > Factory method 'jobBuilders' threw exception; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'jobRepository' defined in class path resource > [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: > Initialization of bean failed; nested exception is > java.lang.NullPointerException > > RELEASE] > at > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1136) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > ... 19 more > Caused by: java.lang.NullPointerException > at > org.apache.servicecomb.provider.rest.common.RestProducers.processProvider(RestProducers.java:52) > ~[provider-rest-common-1.0.0.B003.6.jar:1.0.0.B003.6] > at > org.apache.servicecomb.provider.rest.common.RestProducers.postProcessAfterInitialization(RestProducers.java:43) > ~[provider-rest-common-1.0.0.B003.6.jar:1.0.0.B003.6] > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:423) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at
[jira] [Commented] (SCB-737) avoid null point exception
[ https://issues.apache.org/jira/browse/SCB-737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16644821#comment-16644821 ] ASF GitHub Bot commented on SCB-737: liubao68 commented on a change in pull request #936: [SCB-737]Avoid null point exception URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/936#discussion_r224030028 ## File path: providers/provider-pojo/src/main/java/org/apache/servicecomb/provider/pojo/schema/PojoProducers.java ## @@ -63,6 +63,9 @@ protected void processProvider(String beanName, Object bean) { // aop后,新的实例的父类可能是原class,也可能只是个proxy,父类不是原class // 所以,需要先取出原class,再取标注 Class beanCls = BeanUtils.getImplClassFromBean(bean); +if(beanCls == null) { Review comment: OK, fine. When users defined bean using EnableBatchProcessing, they will not set bean implementation class. So beans annotated with @RestSchema should not do this. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > avoid null point exception > -- > > Key: SCB-737 > URL: https://issues.apache.org/jira/browse/SCB-737 > Project: Apache ServiceComb > Issue Type: Task >Reporter: laijianbin >Assignee: laijianbin >Priority: Major > > 2018-07-11 > 03:27:52,651Z(28241):ERROR{}[main]org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:771)-->Application > startup failed > org.springframework.beans.factory.UnsatisfiedDependencyException: Error > creating bean with name 'batchConfig': Unsatisfied dependency expressed > through field 'jobBuilderFactory'; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'jobBuilders' defined in class path resource > [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: > Bean instantiation via factory method failed; nested exception is > org.springframework.beans.BeanInstantiationException: Failed to instantiate > [org.springframework.batch.core.configuration.annotation.JobBuilderFactory]: > Factory method 'jobBuilders' threw exception; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'jobRepository' defined in class path resource > [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: > Initialization of bean failed; nested exception is > java.lang.NullPointerException > > RELEASE] > at > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1136) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > ... 19 more > Caused by: java.lang.NullPointerException > at > org.apache.servicecomb.provider.rest.common.RestProducers.processProvider(RestProducers.java:52) > ~[provider-rest-common-1.0.0.B003.6.jar:1.0.0.B003.6] > at > org.apache.servicecomb.provider.rest.common.RestProducers.postProcessAfterInitialization(RestProducers.java:43) > ~[provider-rest-common-1.0.0.B003.6.jar:1.0.0.B003.6] > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:423) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at >
[jira] [Commented] (SCB-737) avoid null point exception
[ https://issues.apache.org/jira/browse/SCB-737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16644689#comment-16644689 ] ASF GitHub Bot commented on SCB-737: laijianbin commented on a change in pull request #936: [SCB-737]Avoid null point exception URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/936#discussion_r223995579 ## File path: providers/provider-pojo/src/main/java/org/apache/servicecomb/provider/pojo/schema/PojoProducers.java ## @@ -63,6 +63,9 @@ protected void processProvider(String beanName, Object bean) { // aop后,新的实例的父类可能是原class,也可能只是个proxy,父类不是原class // 所以,需要先取出原class,再取标注 Class beanCls = BeanUtils.getImplClassFromBean(bean); +if(beanCls == null) { Review comment: @liubao68 ,you can reference this blog http://3ms.huawei.com/km/groups/3618383/blogs/details/5589591 To resolve this problem, I just need to add a warn log will be ok? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > avoid null point exception > -- > > Key: SCB-737 > URL: https://issues.apache.org/jira/browse/SCB-737 > Project: Apache ServiceComb > Issue Type: Task >Reporter: laijianbin >Assignee: laijianbin >Priority: Major > > 2018-07-11 > 03:27:52,651Z(28241):ERROR{}[main]org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:771)-->Application > startup failed > org.springframework.beans.factory.UnsatisfiedDependencyException: Error > creating bean with name 'batchConfig': Unsatisfied dependency expressed > through field 'jobBuilderFactory'; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'jobBuilders' defined in class path resource > [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: > Bean instantiation via factory method failed; nested exception is > org.springframework.beans.BeanInstantiationException: Failed to instantiate > [org.springframework.batch.core.configuration.annotation.JobBuilderFactory]: > Factory method 'jobBuilders' threw exception; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'jobRepository' defined in class path resource > [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: > Initialization of bean failed; nested exception is > java.lang.NullPointerException > > RELEASE] > at > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1136) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > ... 19 more > Caused by: java.lang.NullPointerException > at > org.apache.servicecomb.provider.rest.common.RestProducers.processProvider(RestProducers.java:52) > ~[provider-rest-common-1.0.0.B003.6.jar:1.0.0.B003.6] > at > org.apache.servicecomb.provider.rest.common.RestProducers.postProcessAfterInitialization(RestProducers.java:43) > ~[provider-rest-common-1.0.0.B003.6.jar:1.0.0.B003.6] > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:423) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at >
[jira] [Commented] (SCB-737) avoid null point exception
[ https://issues.apache.org/jira/browse/SCB-737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16644417#comment-16644417 ] ASF GitHub Bot commented on SCB-737: liubao68 commented on a change in pull request #936: [SCB-737]Avoid null point exception URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/936#discussion_r223930571 ## File path: providers/provider-pojo/src/main/java/org/apache/servicecomb/provider/pojo/schema/PojoProducers.java ## @@ -63,6 +63,9 @@ protected void processProvider(String beanName, Object bean) { // aop后,新的实例的父类可能是原class,也可能只是个proxy,父类不是原class // 所以,需要先取出原class,再取标注 Class beanCls = BeanUtils.getImplClassFromBean(bean); +if(beanCls == null) { Review comment: Can you add a example or test case showing how this will happen? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > avoid null point exception > -- > > Key: SCB-737 > URL: https://issues.apache.org/jira/browse/SCB-737 > Project: Apache ServiceComb > Issue Type: Task >Reporter: laijianbin >Assignee: laijianbin >Priority: Major > > 2018-07-11 > 03:27:52,651Z(28241):ERROR{}[main]org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:771)-->Application > startup failed > org.springframework.beans.factory.UnsatisfiedDependencyException: Error > creating bean with name 'batchConfig': Unsatisfied dependency expressed > through field 'jobBuilderFactory'; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'jobBuilders' defined in class path resource > [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: > Bean instantiation via factory method failed; nested exception is > org.springframework.beans.BeanInstantiationException: Failed to instantiate > [org.springframework.batch.core.configuration.annotation.JobBuilderFactory]: > Factory method 'jobBuilders' threw exception; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'jobRepository' defined in class path resource > [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: > Initialization of bean failed; nested exception is > java.lang.NullPointerException > > RELEASE] > at > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1136) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > ... 19 more > Caused by: java.lang.NullPointerException > at > org.apache.servicecomb.provider.rest.common.RestProducers.processProvider(RestProducers.java:52) > ~[provider-rest-common-1.0.0.B003.6.jar:1.0.0.B003.6] > at > org.apache.servicecomb.provider.rest.common.RestProducers.postProcessAfterInitialization(RestProducers.java:43) > ~[provider-rest-common-1.0.0.B003.6.jar:1.0.0.B003.6] > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:423) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1594) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at >
[jira] [Commented] (SCB-737) avoid null point exception
[ https://issues.apache.org/jira/browse/SCB-737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16641851#comment-16641851 ] ASF GitHub Bot commented on SCB-737: wujimin commented on a change in pull request #936: [SCB-737]Avoid null point exception URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/936#discussion_r223366629 ## File path: providers/provider-pojo/src/main/java/org/apache/servicecomb/provider/pojo/schema/PojoProducers.java ## @@ -63,6 +63,9 @@ protected void processProvider(String beanName, Object bean) { // aop后,新的实例的父类可能是原class,也可能只是个proxy,父类不是原class // 所以,需要先取出原class,再取标注 Class beanCls = BeanUtils.getImplClassFromBean(bean); +if(beanCls == null) { Review comment: if got null, maybe will cause to lost schema definition so need to print a warn log at least. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > avoid null point exception > -- > > Key: SCB-737 > URL: https://issues.apache.org/jira/browse/SCB-737 > Project: Apache ServiceComb > Issue Type: Task >Reporter: laijianbin >Assignee: laijianbin >Priority: Major > > 2018-07-11 > 03:27:52,651Z(28241):ERROR{}[main]org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:771)-->Application > startup failed > org.springframework.beans.factory.UnsatisfiedDependencyException: Error > creating bean with name 'batchConfig': Unsatisfied dependency expressed > through field 'jobBuilderFactory'; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'jobBuilders' defined in class path resource > [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: > Bean instantiation via factory method failed; nested exception is > org.springframework.beans.BeanInstantiationException: Failed to instantiate > [org.springframework.batch.core.configuration.annotation.JobBuilderFactory]: > Factory method 'jobBuilders' threw exception; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'jobRepository' defined in class path resource > [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: > Initialization of bean failed; nested exception is > java.lang.NullPointerException > > RELEASE] > at > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1136) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > ... 19 more > Caused by: java.lang.NullPointerException > at > org.apache.servicecomb.provider.rest.common.RestProducers.processProvider(RestProducers.java:52) > ~[provider-rest-common-1.0.0.B003.6.jar:1.0.0.B003.6] > at > org.apache.servicecomb.provider.rest.common.RestProducers.postProcessAfterInitialization(RestProducers.java:43) > ~[provider-rest-common-1.0.0.B003.6.jar:1.0.0.B003.6] > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:423) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1594) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] >
[jira] [Commented] (SCB-737) avoid null point exception
[ https://issues.apache.org/jira/browse/SCB-737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16641388#comment-16641388 ] ASF GitHub Bot commented on SCB-737: laijianbin commented on a change in pull request #936: [SCB-737]Avoid null point exception URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/936#discussion_r223254374 ## File path: providers/provider-pojo/src/main/java/org/apache/servicecomb/provider/pojo/schema/PojoProducers.java ## @@ -63,6 +63,9 @@ protected void processProvider(String beanName, Object bean) { // aop后,新的实例的父类可能是原class,也可能只是个proxy,父类不是原class // 所以,需要先取出原class,再取标注 Class beanCls = BeanUtils.getImplClassFromBean(bean); +if(beanCls == null) { Review comment: org.springframework.aop.TargetClassAware.getTargetClass(),this method return the target Class, or null if not known. more detail, reference https://issues.apache.org/jira/browse/SCB-737?filter=-1 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > avoid null point exception > -- > > Key: SCB-737 > URL: https://issues.apache.org/jira/browse/SCB-737 > Project: Apache ServiceComb > Issue Type: Task >Reporter: laijianbin >Assignee: laijianbin >Priority: Major > > 2018-07-11 > 03:27:52,651Z(28241):ERROR{}[main]org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:771)-->Application > startup failed > org.springframework.beans.factory.UnsatisfiedDependencyException: Error > creating bean with name 'batchConfig': Unsatisfied dependency expressed > through field 'jobBuilderFactory'; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'jobBuilders' defined in class path resource > [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: > Bean instantiation via factory method failed; nested exception is > org.springframework.beans.BeanInstantiationException: Failed to instantiate > [org.springframework.batch.core.configuration.annotation.JobBuilderFactory]: > Factory method 'jobBuilders' threw exception; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'jobRepository' defined in class path resource > [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]: > Initialization of bean failed; nested exception is > java.lang.NullPointerException > > RELEASE] > at > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1136) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at > org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > ... 19 more > Caused by: java.lang.NullPointerException > at > org.apache.servicecomb.provider.rest.common.RestProducers.processProvider(RestProducers.java:52) > ~[provider-rest-common-1.0.0.B003.6.jar:1.0.0.B003.6] > at > org.apache.servicecomb.provider.rest.common.RestProducers.postProcessAfterInitialization(RestProducers.java:43) > ~[provider-rest-common-1.0.0.B003.6.jar:1.0.0.B003.6] > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:423) > ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE] > at >