[ 
https://issues.apache.org/jira/browse/SCB-737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1594)
>  ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]
>         at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:554)
>  ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]
>         at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
>  ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]
>         at 
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
>  ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.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:197)
>  ~[spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]
>         at 
> org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:381)
>  ~[spring-context-4.3.5.RELEASE.jar:4.3.5.RELEASE]
>         at 
> *org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration*$$EnhancerBySpringCGLIB$$9c449ea7.jobRepository(<generated>)
>  ~[spring-batch-core-3.0.8.RELEASE.jar:3.0.8.RELEASE]
>         at 
> org.springframework.batch.core.configuration.annotation.AbstractBatchConfiguration.jobBuilders(AbstractBatchConfiguration.java:58)
>  ~[spring-batch-core-3.0.8.RELEASE.jar:3.0.8.RELEASE]
>         at 
> org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$$EnhancerBySpringCGLIB$$9c449ea7.CGLIB$jobBuilders$7(<generated>)
>  ~[spring-batch-core-3.0.8.RELEASE.jar:3.0.8.RELEASE]
>         at 
> org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$$EnhancerBySpringCGLIB$$9c449ea7$$FastClassBySpringCGLIB$$66766304.invoke(<generated>)
>  ~[spring-batch-core-3.0.8.RELEASE.jar:3.0.8.RELEASE]
>         at 
> org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) 
> ~[spring-core-4.3.5.RELEASE.jar:4.3.5.RELEASE]
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to