You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/09/03 04:31:05 UTC

[GitHub] lzimd opened a new issue #2429: dubbo + quartz + spring NPE

lzimd opened a new issue #2429: dubbo + quartz + spring NPE
URL: https://github.com/apache/incubator-dubbo/issues/2429
 
 
   ### Environment
   
   * Dubbo version: 2.6.2
   * spring boot 2.0.0.RELEASE
   
   ### Actual Result
   
   ```
   org.quartz.SchedulerException: Job instantiation failed
   	at org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:47) ~[spring-context-support-5.0.4.RELEASE.jar:5.0.4.RELEASE]
   	at org.quartz.core.JobRunShell.initialize(JobRunShell.java:127) ~[quartz-2.3.0.jar:na]
   	at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:392) [quartz-2.3.0.jar:na]
   Caused by: java.lang.NullPointerException: null
   	at com.alibaba.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor.postProcessBeforeInitialization(DubboConfigBindingBeanPostProcessor.java:78) ~[dubbo-2.6.2.jar:2.6.2]
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:423) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:414) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
   	at org.springframework.boot.autoconfigure.quartz.AutowireCapableBeanJobFactory.createJobInstance(AutowireCapableBeanJobFactory.java:45) ~[spring-boot-autoconfigure-2.0.0.RELEASE.jar:2.0.0.RELEASE]
   	at org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:43) ~[spring-context-support-5.0.4.RELEASE.jar:5.0.4.RELEASE]
   	... 2 common frames omitted
   ```
   
   1.  org.springframework.scheduling.quartz.AdaptableJobFactory.newJob
   ```
   public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException {
   	try {
   		Object jobObject = createJobInstance(bundle);
   		return adaptJob(jobObject);
   	}
   	catch (Throwable ex) {
   		throw new SchedulerException("Job instantiation failed", ex);
   	}
   }
   ```
   2. initializeBean(**beanName = null**)
   org.springframework.boot.autoconfigure.quartz.AutowireCapableBeanJobFactory
   ```
   protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
   	Object jobInstance = super.createJobInstance(bundle);
   	this.beanFactory.autowireBean(jobInstance);
          // Object initializeBean(Object existingBean, String beanName) throws BeansException
   	this.beanFactory.initializeBean(jobInstance, null); 
   	return jobInstance;
   }
   ```
   3.  AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization
   ```
   for (BeanPostProcessor beanProcessor : getBeanPostProcessors()) {
   	Object current = beanProcessor.postProcessBeforeInitialization(result, beanName);
   	if (current == null) {
   		return result;
   	}
   	result = current;
   }
   ```
   4. **NPE DubboConfigBindingBeanPostProcessor** [link](https://github.com/apache/incubator-dubbo/blob/7a48fac84b14ac6a21c1bdfc5958705dd8dda84d/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/beans/factory/annotation/DubboConfigBindingBeanPostProcessor.java#L78) 
   
   ```
   78  if (beanName.equals(this.beanName) && bean instanceof AbstractConfig) {
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org