You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by "Flamelay (via GitHub)" <gi...@apache.org> on 2023/02/08 07:57:30 UTC

[GitHub] [shenyu] Flamelay opened a new issue, #4365: [Question] When deploying:nacosSyncDataService NullPointerException

Flamelay opened a new issue, #4365:
URL: https://github.com/apache/shenyu/issues/4365

   ### Question
   
   Use nacos for data synchronization. There is no problem running shenyu-bootstrap locally. Use the shenyu-bootstrap-dist module to package. The following error is reported in the virtual machine
   
   ```
   2023-02-08 07:41:22 [main] WARN  org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nacosSyncDataService' defined in class path resource [org/apache/shenyu/springboot/starter/sync/data/nacos/NacosSyncDataConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shenyu.sync.data.api.SyncDataService]: Factory method 'nacosSyncDataService' threw exception; nested exception is java.lang.NullPointerException
   2023-02-08 07:41:22 [main] INFO  org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener -
   
   Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
   2023-02-08 07:41:22 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
   org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nacosSyncDataService' defined in class path resource [org/apache/shenyu/springboot/starter/sync/data/nacos/NacosSyncDataConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shenyu.sync.data.api.SyncDataService]: Factory method 'nacosSyncDataService' threw exception; nested exception is java.lang.NullPointerException
           at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
           at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
           at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
           at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
           at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
           at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953)
           at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
           at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
           at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:64)
           at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:745)
           at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:420)
           at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
           at org.springframework.boot.SpringApplication.run(SpringApplication.java:1317)
           at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
           at org.apache.shenyu.bootstrap.ShenyuBootstrapApplication.main(ShenyuBootstrapApplication.java:35)
   Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shenyu.sync.data.api.SyncDataService]: Factory method 'nacosSyncDataService' threw exception; nested exception is java.lang.NullPointerException
           at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
           at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
           ... 19 common frames omitted
   Caused by: java.lang.NullPointerException: null
           at org.apache.shenyu.plugin.api.utils.SpringBeanUtils.getBean(SpringBeanUtils.java:55)
           at org.apache.shenyu.plugin.base.trie.ShenyuTrieRuleListener.lambda$onApplicationEvent$2(ShenyuTrieRuleListener.java:52)
           at java.util.ArrayList.forEach(ArrayList.java:1257)
           at org.apache.shenyu.plugin.base.trie.ShenyuTrieRuleListener.onApplicationEvent(ShenyuTrieRuleListener.java:52)
           at org.apache.shenyu.plugin.base.trie.ShenyuTrieRuleListener.onApplicationEvent(ShenyuTrieRuleListener.java:35)
           at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
           at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
           at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
           at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421)
           at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378)
           at org.apache.shenyu.plugin.base.cache.CommonPluginDataSubscriber.removeCacheData(CommonPluginDataSubscriber.java:252)
           at org.apache.shenyu.plugin.base.cache.CommonPluginDataSubscriber.lambda$subscribeDataHandler$4(CommonPluginDataSubscriber.java:170)
           at java.util.Optional.ifPresent(Optional.java:159)
           at org.apache.shenyu.plugin.base.cache.CommonPluginDataSubscriber.subscribeDataHandler(CommonPluginDataSubscriber.java:170)
           at org.apache.shenyu.plugin.base.cache.CommonPluginDataSubscriber.unRuleSubscribe(CommonPluginDataSubscriber.java:147)
           at org.apache.shenyu.sync.data.nacos.handler.NacosCacheHandler.lambda$updateRuleMap$4(NacosCacheHandler.java:116)
           at java.util.Optional.ifPresent(Optional.java:159)
           at org.apache.shenyu.sync.data.nacos.handler.NacosCacheHandler.lambda$updateRuleMap$5(NacosCacheHandler.java:115)
           at java.util.ArrayList.forEach(ArrayList.java:1257)
           at org.apache.shenyu.sync.data.nacos.handler.NacosCacheHandler.updateRuleMap(NacosCacheHandler.java:115)
           at org.apache.shenyu.sync.data.nacos.handler.NacosCacheHandler.watcherData(NacosCacheHandler.java:173)
           at org.apache.shenyu.sync.data.nacos.NacosSyncDataService.start(NacosSyncDataService.java:56)
           at org.apache.shenyu.sync.data.nacos.NacosSyncDataService.<init>(NacosSyncDataService.java:47)
           at org.apache.shenyu.springboot.starter.sync.data.nacos.NacosSyncDataConfiguration.nacosSyncDataService(NacosSyncDataConfiguration.java:67)
           at org.apache.shenyu.springboot.starter.sync.data.nacos.NacosSyncDataConfiguration$$EnhancerBySpringCGLIB$$abeae9b.CGLIB$nacosSyncDataService$0(<generated>)
           at org.apache.shenyu.springboot.starter.sync.data.nacos.NacosSyncDataConfiguration$$EnhancerBySpringCGLIB$$abeae9b$$FastClassBySpringCGLIB$$ce526c90.invoke(<generated>)
           at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
           at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
           at org.apache.shenyu.springboot.starter.sync.data.nacos.NacosSyncDataConfiguration$$EnhancerBySpringCGLIB$$abeae9b.nacosSyncDataService(<generated>)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
           ... 20 common frames omitted
   
   ```


-- 
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@shenyu.apache.org.apache.org

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


[GitHub] [shenyu] Flamelay commented on issue #4365: [Question] When deploying:nacosSyncDataService NullPointerException

Posted by "Flamelay (via GitHub)" <gi...@apache.org>.
Flamelay commented on issue #4365:
URL: https://github.com/apache/shenyu/issues/4365#issuecomment-1422299927

   It seems that it may be the problem of dependency injection of nacos synchronous data?


-- 
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@shenyu.apache.org

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


[GitHub] [shenyu] Flamelay commented on issue #4365: [Question] When deploying:nacosSyncDataService NullPointerException

Posted by "Flamelay (via GitHub)" <gi...@apache.org>.
Flamelay commented on issue #4365:
URL: https://github.com/apache/shenyu/issues/4365#issuecomment-1422299504

   > 
   
   
   
   > Do you try using the latest version?
   It should be. The code just pulled from github yesterday


-- 
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@shenyu.apache.org

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


[GitHub] [shenyu] Flamelay closed issue #4365: [Question] When deploying:nacosSyncDataService NullPointerException

Posted by "Flamelay (via GitHub)" <gi...@apache.org>.
Flamelay closed issue #4365: [Question] When deploying:nacosSyncDataService NullPointerException
URL: https://github.com/apache/shenyu/issues/4365


-- 
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@shenyu.apache.org

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


[GitHub] [shenyu] Flamelay commented on issue #4365: [Question] When deploying:nacosSyncDataService NullPointerException

Posted by "Flamelay (via GitHub)" <gi...@apache.org>.
Flamelay commented on issue #4365:
URL: https://github.com/apache/shenyu/issues/4365#issuecomment-1422294010

   > Looks like the ApplicationContext was used without loading. Can you provide your jar file?
   
   I'm still trying. If the following dependencies in pom.xml of shenyu-bootstrap are commented out during packaging, there will be no problem in running
   
   ```
   <!--         apache shenyu data sync start use nacos-->
           <dependency>
               <groupId>org.apache.shenyu</groupId>
               <artifactId>shenyu-spring-boot-starter-sync-data-nacos</artifactId>
               <version>${project.version}</version>
           </dependency>
   ```


-- 
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@shenyu.apache.org

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


[GitHub] [shenyu] iwangjie commented on issue #4365: [Question] When deploying:nacosSyncDataService NullPointerException

Posted by "iwangjie (via GitHub)" <gi...@apache.org>.
iwangjie commented on issue #4365:
URL: https://github.com/apache/shenyu/issues/4365#issuecomment-1422676443

   I used the latest code to start locally and reported no repetition error. Please try to clean up the workspace thoroughly and repackage it. 


-- 
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@shenyu.apache.org

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


[GitHub] [shenyu] Flamelay commented on issue #4365: [Question] When deploying:nacosSyncDataService NullPointerException

Posted by "Flamelay (via GitHub)" <gi...@apache.org>.
Flamelay commented on issue #4365:
URL: https://github.com/apache/shenyu/issues/4365#issuecomment-1423558643

   
   > I used the latest code to start locally and reported no repetition error. Please try to clean up the workspace thoroughly and repackage it.
   It has been solved. It seems that it is really a version problem. 2.5.1-SNAPSHOT can be replaced by 2.5.1. Thank you very much for your answer
   


-- 
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@shenyu.apache.org

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


[GitHub] [shenyu] iwangjie commented on issue #4365: [Question] When deploying:nacosSyncDataService NullPointerException

Posted by "iwangjie (via GitHub)" <gi...@apache.org>.
iwangjie commented on issue #4365:
URL: https://github.com/apache/shenyu/issues/4365#issuecomment-1422274444

   Looks like the ApplicationContext was used without loading. Can you provide your jar file?


-- 
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@shenyu.apache.org

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


[GitHub] [shenyu] iwangjie commented on issue #4365: [Question] When deploying:nacosSyncDataService NullPointerException

Posted by "iwangjie (via GitHub)" <gi...@apache.org>.
iwangjie commented on issue #4365:
URL: https://github.com/apache/shenyu/issues/4365#issuecomment-1422296194

   Do you try using the latest version?


-- 
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@shenyu.apache.org

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