GatewayApplication因WebMvcConfigurer找不到而无法启动

Blade 已结 4 5306
嗨SpringCloud
嗨SpringCloud 剑者 2020-04-05 10:44

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

1. 我在原项目上,在blade-common模块里添加了MybatisPlusConfiguration,扫描自己的包名

2. 启动了redis,nacos,sentinel,除了gateway服务(以及运维相关的服务,如Admin这种),都能成功启动

3. 当启动gatewayApplication时无法启动,报错:无法打开WebMvcConfigurer。


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

成功启动;报错


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

spring-blade;win 10


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

"C:\Program Files\Java\jdk1.8.0_171\bin\java.exe" -Xms256m -Xmx256m -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=51043 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:\intellij\IntelliJ IDEA 2018.1.2\lib\idea_rt.jar=51044:D:\intellij\IntelliJ IDEA 2018.1.2\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\小江\AppData\Local\Temp\classpath1882312910.jar org.springblade.gateway.GateWayApplication

----启动中,读取到的环境变量:[dev],jar地址:[/E:/wekb/Trunk/webk_service/blade-gateway/target/classes/]----

 _____               _                 ______  _             _

/  ___|             (_)                | ___ \| |           | |

\ `--.  _ __   _ __  _  _ __    __ _   | |_/ /| |  __ _   __| |  ___

 `--. \| '_ \ | '__|| || '_ \  / _` |  | ___ \| | / _` | / _` | / _ \

/\__/ /| |_) || |   | || | | || (_| |  | |_/ /| || (_| || (_| ||  __/

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

       | |                      __/ |

       |_|                     |___/


:: SpringBlade :: blade-gateway:dev :: Running SpringBoot 2.2.5.RELEASE :: 


2020-04-05 10:39:06.546  INFO 19548 --- [           main] c.a.n.c.c.impl.LocalConfigInfoProcessor  : LOCAL_SNAPSHOT_PATH:C:\Users\小江\nacos\config

2020-04-05 10:39:06.646  INFO 19548 --- [           main] c.a.nacos.client.config.impl.Limiter     : limitTime:5.0

2020-04-05 10:39:06.732  WARN 19548 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[blade] & group[DEFAULT_GROUP]

2020-04-05 10:39:06.754  INFO 19548 --- [           main] c.a.nacos.client.config.utils.JVMUtil    : isMultiInstance:false

2020-04-05 10:39:06.786  INFO 19548 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-blade-dev.yaml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-blade.yaml,DEFAULT_GROUP'}, BootstrapPropertySource {name='bootstrapProperties-blade,DEFAULT_GROUP'}]

2020-04-05 10:39:06.791  INFO 19548 --- [           main] o.s.gateway.GateWayApplication           : The following profiles are active: dev

2020-04-05 10:39:07.591  WARN 19548 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springblade.gateway.GateWayApplication]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/web/servlet/config/annotation/WebMvcConfigurer.class] cannot be opened because it does not exist

2020-04-05 10:39:07.603  INFO 19548 --- [           main] ConditionEvaluationReportLoggingListener : 


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

2020-04-05 10:39:07.619 ERROR 19548 --- [           main] o.s.boot.SpringApplication               : Application run failed


org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springblade.gateway.GateWayApplication]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/web/servlet/config/annotation/WebMvcConfigurer.class] cannot be opened because it does not exist

at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:609) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.context.annotation.ConfigurationClassParser.access$800(ConfigurationClassParser.java:110) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.lambda$processGroupImports$1(ConfigurationClassParser.java:811) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at java.util.ArrayList.forEach(ArrayList.java:1257) ~[na:1.8.0_171]

at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:808) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:779) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:192) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:319) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

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

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

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

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

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

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

at org.springblade.core.launch.BladeApplication.run(BladeApplication.java:49) [blade-core-launch-2.6.2.jar:na]

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

Caused by: java.io.FileNotFoundException: class path resource [org/springframework/web/servlet/config/annotation/WebMvcConfigurer.class] cannot be opened because it does not exist

at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:180) ~[spring-core-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:56) ~[spring-core-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:50) ~[spring-core-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103) ~[spring-core-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:86) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]

at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:73) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]

at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81) ~[spring-core-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:695) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getInterfaces(ConfigurationClassParser.java:1027) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.context.annotation.ConfigurationClassParser.processInterfaces(ConfigurationClassParser.java:385) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:331) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

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

at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:599) ~[spring-context-5.2.4.RELEASE.jar:5.2.4.RELEASE]

... 19 common frames omitted



Process finished with exit code 1


五、若有更多详细信息,请在下面提供。



4条回答
  •  zhx1994
    zhx1994 (最佳回答者)
    2020-04-06 14:12

    gateway基于webflux的,不能引入web的相关依赖。

    2 讨论(1)
  • 2020-04-05 11:25

     为什么在common模块引入blade-core-mybatis里会有web相关依赖,导致gateway无法启动成功呢

    0 讨论(0)
  • 2020-05-25 14:11

    我是付费版,,我也遇到这人问题,请问怎么解决

    0 讨论(0)
  • 2020-10-28 16:34

    同问

    0 讨论(0)
提交回复