Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot invoke Bucket4JBootProperties.getMethods()" because "bucket4jProperties" is null #297

Closed
roma2341 opened this issue May 2, 2024 · 5 comments · Fixed by #303
Closed
Milestone

Comments

@roma2341
Copy link

roma2341 commented May 2, 2024

I have an error:

2024-05-02T17:38:15.031+03:00  WARN 165391 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.giffing.bucket4j.spring.boot.starter.config.cache.Bucket4jCacheConfiguration]: Error processing condition on com.giffing.bucket4j.spring.boot.starter.config.cache.jcache.JCacheBucket4jConfiguration
2024-05-02T17:38:15.037+03:00  INFO 165391 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-05-02T17:38:15.057+03:00 ERROR 165391 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.giffing.bucket4j.spring.boot.starter.config.cache.Bucket4jCacheConfiguration]: Error processing condition on com.giffing.bucket4j.spring.boot.starter.config.cache.jcache.JCacheBucket4jConfiguration
	at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:544) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:321) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:246) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:534) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.lambda$processGroupImports$1(ConfigurationClassParser.java:746) ~[spring-context-6.1.3.jar:6.1.3]
	at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:743) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:714) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:183) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:416) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:289) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:788) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:606) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.2.jar:3.2.2]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.2.jar:3.2.2]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.2.jar:3.2.2]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[spring-boot-3.2.2.jar:3.2.2]
	at com.shs.CrmApplication.main(CrmApplication.java:20) ~[classes/:na]
Caused by: java.lang.IllegalStateException: Error processing condition on com.giffing.bucket4j.spring.boot.starter.config.cache.jcache.JCacheBucket4jConfiguration
	at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60) ~[spring-boot-autoconfigure-3.2.2.jar:3.2.2]
	at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:220) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:534) ~[spring-context-6.1.3.jar:6.1.3]
	... 19 common frames omitted
Caused by: java.lang.NullPointerException: Cannot invoke "com.giffing.bucket4j.spring.boot.starter.context.properties.Bucket4JBootProperties.getMethods()" because "bucket4jProperties" is null
	at com.giffing.bucket4j.spring.boot.starter.config.condition.OnSynchronousPropertyCondition.getMatchOutcome(OnSynchronousPropertyCondition.java:15) ~[bucket4j-spring-boot-starter-0.12.6.jar:0.12.6]
	at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-3.2.2.jar:3.2.2]
	... 22 common frames omitted

@roma2341
Copy link
Author

roma2341 commented May 2, 2024

Error was unclear, fixed by adding these lines to application.yaml:

bucket4j:
  enabled: true
  

@MarcGiffing MarcGiffing added this to the 0.12.7 milestone May 30, 2024
MarcGiffing added a commit that referenced this issue May 30, 2024
…cause bucket4j properties is null (#303)

* Cannot invoke Bucket4JBootProperties.getMethods()" because "bucket4jProperties" is null #297

* Cannot invoke Bucket4JBootProperties.getMethods()" because "bucket4jProperties" is null #297
@MarcGiffing
Copy link
Owner

I coudn't find the root cause but I hope the MR will fix the exception

@ShriramDeshkar
Copy link

ShriramDeshkar commented Aug 8, 2024

@MarcGiffing
Getting the same error please find below error description I m getting.

NullPointerException: Cannot invoke com.giffing.bucket4j.spring.boot.starter.context.properties.Bucket4JBootProperties.getMethods() because bucket4jProperties is null.
I m getting this error from version 0.12.3 onwards.

@roma2341
Copy link
Author

roma2341 commented Aug 8, 2024

@MarcGiffing Getting the same error please find below error description I m getting.

NullPointerException: Cannot invoke com.giffing.bucket4j.spring.boot.starter.context.properties.Bucket4JBootProperties.getMethods() because bucket4jProperties is null. I m getting this error from version 0.12.3 onwards.

Did you try "bucket4j.enabled=true" option in application properties?

@ShriramDeshkar
Copy link

ShriramDeshkar commented Aug 8, 2024

@MarcGiffing
Yes...that also didn't work. However its working without setting that property till version 0.12.2.

Please find below detail error I m getting as soon as I upgrade it to 0.12.3, I m using it in azure java function.

NullPointerException: Cannot invoke "com.giffing.bucket4j.spring.boot.starter.context.properties.Bucket4JBootProperties.getMethods()" because "bucket4jProperties" is null
Stack: java.lang.IllegalStateException: Failed to initialize
at org.springframework.cloud.function.adapter.azure.AzureFunctionInstanceInjector.getInstance(AzureFunctionInstanceInjector.java:80)
at com.microsoft.azure.functions.worker.binding.ExecutionContextDataSource.getFunctionInstance(ExecutionContextDataSource.java:103)
at com.microsoft.azure.functions.worker.broker.JavaMethodInvokeInfo.invoke(JavaMethodInvokeInfo.java:20)
at com.microsoft.azure.functions.worker.broker.EnhancedJavaMethodExecutorImpl.execute(EnhancedJavaMethodExecutorImpl.java:22)
at com.microsoft.azure.functions.worker.chain.FunctionExecutionMiddleware.invoke(FunctionExecutionMiddleware.java:19)
at com.microsoft.azure.functions.worker.chain.InvocationChain.doNext(InvocationChain.java:21)
at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:125)
at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:34)
at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10)
at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:44)
at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:94)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.giffing.bucket4j.spring.boot.starter.config.cache.Bucket4jCacheConfiguration]: Error processing condition on com.giffing.bucket4j.spring.boot.starter.config.cache.jcache.JCacheBucket4jConfiguration
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:544)
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:321)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:246)
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:534)
at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.lambda$processGroupImports$1(ConfigurationClassParser.java:746)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:743)
at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:714)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:183)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:417)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:290)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:789)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:607)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
at org.springframework.cloud.function.adapter.azure.AzureFunctionInstanceInjector.initialize(AzureFunctionInstanceInjector.java:92)
at org.springframework.cloud.function.adapter.azure.AzureFunctionInstanceInjector.getInstance(AzureFunctionInstanceInjector.java:66)
... 15 more
Caused by: java.lang.IllegalStateException: Error processing condition on com.giffing.bucket4j.spring.boot.starter.config.cache.jcache.JCacheBucket4jConfiguration
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60)
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:220)
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:534)
... 34 more
Caused by: java.lang.NullPointerException: Cannot invoke "com.giffing.bucket4j.spring.boot.starter.context.properties.Bucket4JBootProperties.getMethods()" because "bucket4jProperties" is null
at com.giffing.bucket4j.spring.boot.starter.config.condition.OnSynchronousPropertyCondition.getMatchOutcome(OnSynchronousPropertyCondition.java:15)
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
... 37 more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants