gateway模块通过feign调用user模块启动不了

Blade 未结 1 405
求道玉
求道玉 2024-01-03 11:55
悬赏:5

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

  1. 用第三方的token在gateway那里解析,并且通过feign调用use模块的服务,启动报错,

  2. 我已经按需求配置开启了feign

    image.png

    这两个注解不管有没有注释都报一样的错误

  3. image.png

  4. 1704253809023.png

pom依赖:



    
        BladeX
        org.springblade
        2.8.0.RELEASE
    
    4.0.0

    blade-gateway
    ${project.artifactId}
    ${bladex.project.version}
    jar

    
        
        
            org.springblade
            blade-core-launch
            
               
                
                    org.springframework.boot
                    spring-boot-starter-undertow
                
            
        
        
            org.springblade
            blade-common
            
                
                    org.springblade
                    blade-core-launch
                
            
        
        
            org.springblade
            blade-starter-metrics
        
        
            org.springblade
            blade-starter-jwt
        
        
            com.alibaba
            fastjson
        
        
        
            org.springframework.cloud
            spring-cloud-starter-gateway
        
        
            org.springframework.boot
            spring-boot-starter-data-redis-reactive
        
        
        
            org.springblade
            blade-user-api
            ${bladex.project.version}
        
        
      
        
        
        
            org.springblade
            blade-core-db
            2.8.0.RELEASE
        
        
            org.springblade
            blade-core-cloud
            2.8.0.RELEASE
        


    

    
        
            
                com.spotify
                dockerfile-maven-plugin
                
                    ${docker.username}
                    ${docker.password}
                    ${docker.registry.url}/${docker.namespace}/${project.artifactId}
                    ${project.version}
                    true
                    
                        target/${project.build.finalName}.jar
                    
                    false
                
            
            
                org.apache.maven.plugins
                maven-antrun-plugin
            
        
    


3.gateway模块启动报错内容:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blockExceptionHandler' defined in class path resource [org/springblade/core/cloud/sentinel/BladeSentinelAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springblade.core.cloud.sentinel.BladeBlockExceptionHandler] from ClassLoader [java.net.URLClassLoader@12c8a2c0]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66) ~[spring-boot-2.2.13.RELEASE.jar:2.2.13.RELEASE]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.13.RELEASE.jar:2.2.13.RELEASE]

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405) ~[spring-boot-2.2.13.RELEASE.jar:2.2.13.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.13.RELEASE.jar:2.2.13.RELEASE]

at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) [spring-boot-2.2.13.RELEASE.jar:2.2.13.RELEASE]

at org.springblade.core.launch.BladeApplication.run(BladeApplication.java:50) [blade-core-launch-2.8.0.RELEASE.jar:na]

at org.springblade.gateway.GateWayApplication.main(GateWayApplication.java:38) [classes/:na]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]

at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]

at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:64) [idea_rt.jar:na]

Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springblade.core.cloud.sentinel.BladeBlockExceptionHandler] from ClassLoader [java.net.URLClassLoader@12c8a2c0]

at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481) ~[spring-core-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:321) ~[spring-core-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.buildLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:232) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.findLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:210) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(InitDestroyAnnotationBeanPostProcessor.java:149) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:294) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1093) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:568) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]

... 20 common frames omitted

Caused by: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest

at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_121]

at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_121]

at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_121]

at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.2.12.RELEASE.jar:5.2.12.RELEASE]

... 27 common frames omitted


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

我看了一下依赖包都是

2.8.0.RELEASE

版本的,求解决方法

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

用的是blade 2.8.0.release版本


1条回答
  •  zhx1994
    zhx1994 (楼主)
    2024-01-03 14:17

    gateway中无法调用feign - Blade技术社区 (bladex.cn)

    作者追问:2024-01-03 14:17

    你好,我看了一下你发的那个,我和他的问题不一样,我的是blockExceptionHandler这个类,不是WebMvcConfigurer.class] cannot be opened because it does not exist,他那个方法无法解决我这个问题

    0 讨论(0)
提交回复