bladex单体版3.1.1.RELEASE ,eclipse 启动有时总是找不到bean的问题

Blade 未结 2 609
445070583
445070583 剑童 2023-09-05 09:37
悬赏:10

一、该问题的重现步骤是什么?

1. bladex 单体版启动有时总是出现找不到bean,例如org.springblade.core.context.BladeContext 或者redisProperty socalProperty等

2.  在 springboot 下增加了main\resources\META-INF\spring.factories  问题依旧

3.在启动类 增加 @ComponentScan("org.springblade") ,又出现 Caused by: java.lang.ClassNotFoundException: org.springframework.cloud.loadbalancer.annotation.LoadBalancerClientConfiguration

         

目前开发工具启动项目报错,但是打包后jar文件,cmd命令启动jar 不报错



二、你期待的结果是什么?实际看到的又是什么

经过多个项目验证,发现eclipse开发时 2.8的版本相对稳定 


三、你正在使用的是什么产品,什么版本?在什么操作系统上?

版本 3.1.1.RELEASE  单体版 ,开发工具eclipse  window 11

四、请提供详细的错误堆栈信息,这很重要。

       | |_/ /| || (_| || (_| ||  __/ /  .  \

                   \____/ |_| \__,_| \__,_| \___|/__/ \__\


:: BladeX 3.1.1.RELEASE :: blade-api:dev :: Running SpringBoot 2.7.11 :: 


2023-09-05 09:26:43.862  INFO 15732 --- [           main] org.springblade.Application              : The following 1 profile is active: "dev"

2023-09-05 09:26:45.990  INFO 15732 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode

2023-09-05 09:26:45.997  INFO 15732 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.

2023-09-05 09:26:46.281  INFO 15732 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 260 ms. Found 0 Redis repository interfaces.

2023-09-05 09:26:46.537  WARN 15732 --- [           main] o.m.s.mapper.ClassPathMapperScanner      : No MyBatis mapper was found in '[org.springblade]' package. Please check your configuration.

2023-09-05 09:26:46.720  INFO 15732 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=cd480db9-9845-3a4d-a37a-f24e02d6e21f

2023-09-05 09:26:47.276  INFO 15732 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.commons.config.CommonsConfigAutoConfiguration' of type [org.springframework.cloud.commons.config.CommonsConfigAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2023-09-05 09:26:47.279  INFO 15732 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2023-09-05 09:26:47.280  INFO 15732 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'loadBalancerClientsDefaultsMappingsProvider' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration$$Lambda$486/126791597] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2023-09-05 09:26:47.281  INFO 15732 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'defaultsBindHandlerAdvisor' of type [org.springframework.cloud.commons.config.DefaultsBindHandlerAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2023-09-05 09:26:47.287  INFO 15732 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.datasource.dynamic-com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties' of type [com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2023-09-05 09:26:47.290  INFO 15732 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration' of type [com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration$$EnhancerBySpringCGLIB$$ba661e2b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2023-09-05 09:26:47.322  INFO 15732 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'dsProcessor' of type [com.baomidou.dynamic.datasource.processor.DsHeaderProcessor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2023-09-05 09:26:48.176  WARN 15732 --- [           main] io.undertow.websockets.jsr               : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used

2023-09-05 09:26:48.245  INFO 15732 --- [           main] io.undertow.servlet                      : Initializing Spring embedded WebApplicationContext

2023-09-05 09:26:48.245  INFO 15732 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 4358 ms

2023-09-05 09:26:48.402  WARN 15732 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bladeExecutorConfiguration' defined in file [E:\软信工作笔记\文旅项目\源码\culturalTourismApi\culturalTourismApi\culturalTourism-tool\blade-core-boot\target\classes\org\springblade\core\boot\config\BladeExecutorConfiguration.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springblade.core.context.BladeContext' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

2023-09-05 09:26:48.409  INFO 15732 --- [           main] ConditionEvaluationReportLoggingListener : 


Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2023-09-05 09:26:48.448 ERROR 15732 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 


***************************

APPLICATION FAILED TO START

***************************


Description:


Parameter 0 of constructor in org.springblade.core.boot.config.BladeExecutorConfiguration required a bean of type 'org.springblade.core.context.BladeContext' that could not be found.



Action:


Consider defining a bean of type 'org.springblade.core.context.BladeContext' in your configuration.






五、第二种报错



org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [org.springblade.Application]; nested exception is java.lang.IllegalArgumentException: Could not find class [org.springframework.cloud.loadbalancer.annotation.LoadBalancerClientConfiguration]

at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:188) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:331) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:748) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.11.jar:2.7.11]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.11.jar:2.7.11]

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.11.jar:2.7.11]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.11.jar:2.7.11]

at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164) [spring-boot-2.7.11.jar:2.7.11]

at org.springblade.core.launch.BladeApplication.run(BladeApplication.java:50) [classes/:na]

at org.springblade.Application.main(Application.java:37) [classes/:na]

Caused by: java.lang.IllegalArgumentException: Could not find class [org.springframework.cloud.loadbalancer.annotation.LoadBalancerClientConfiguration]

at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:334) ~[spring-core-5.3.27.jar:5.3.27]

at org.springframework.core.annotation.TypeMappedAnnotation.adapt(TypeMappedAnnotation.java:474) ~[spring-core-5.3.27.jar:5.3.27]

at org.springframework.core.annotation.TypeMappedAnnotation.getValue(TypeMappedAnnotation.java:397) ~[spring-core-5.3.27.jar:5.3.27]

at org.springframework.core.annotation.TypeMappedAnnotation.asMap(TypeMappedAnnotation.java:283) ~[spring-core-5.3.27.jar:5.3.27]

at org.springframework.core.annotation.AbstractMergedAnnotation.asAnnotationAttributes(AbstractMergedAnnotation.java:193) ~[spring-core-5.3.27.jar:5.3.27]

at org.springframework.core.type.AnnotatedTypeMetadata.getAnnotationAttributes(AnnotatedTypeMetadata.java:106) ~[spring-core-5.3.27.jar:5.3.27]

at org.springframework.core.type.AnnotatedTypeMetadata.getAnnotationAttributes(AnnotatedTypeMetadata.java:81) ~[spring-core-5.3.27.jar:5.3.27]

at org.springframework.context.annotation.AnnotationConfigUtils.attributesFor(AnnotationConfigUtils.java:285) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.context.annotation.AnnotationBeanNameGenerator.determineBeanNameFromAnnotation(AnnotationBeanNameGenerator.java:103) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.context.annotation.AnnotationBeanNameGenerator.generateBeanName(AnnotationBeanNameGenerator.java:82) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:280) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:128) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:295) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:249) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:206) ~[spring-context-5.3.27.jar:5.3.27]

at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:174) ~[spring-context-5.3.27.jar:5.3.27]

... 13 common frames omitted

Caused by: java.lang.ClassNotFoundException: org.springframework.cloud.loadbalancer.annotation.LoadBalancerClientConfiguration

at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_241]

at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_241]

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) ~[na:1.8.0_241]

at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_241]

at java.lang.Class.forName0(Native Method) ~[na:1.8.0_241]


2条回答
  • https://sns.bladex.cn/q-116.html

    0 讨论(0)
  • 2024-04-22 17:01

    我提问题的时候已经试过了 在 springboot 下增加了main\resources\META-INF\spring.factories  问题依旧,目前开发时 用 的单体版,总是项目今天可能启动正常 ,明天可能启动不正常,主要是问题都是找不到bean,感觉非常的奇怪,我看配置的都正确,项目时好时坏 唉一言难尽,望官方修复

    0 讨论(0)
提交回复