idea上启动没问题,打成jar包启动就报错,不知道什么原因,请大神看看
下面是报错信息
:: SpringBlade :: blade-gateway:dev :: Running SpringBoot 2.0.8.RELEASE ::
Sat May 18 17:01:56 CST 2019 org.springframework.boot.loader.LaunchedURLClassLoader@20ad9418 JM.Log:INFO Init JM logger with Slf4jLoggerFactory success, org.springframework.boot.loader.LaunchedURLClassLoader@20ad9418
Sat May 18 17:01:56 CST 2019 org.springframework.boot.loader.LaunchedURLClassLoader@20ad9418 JM.Log:INFO Log root path: C:\Users\th-pc\logs\
Sat May 18 17:01:56 CST 2019 org.springframework.boot.loader.LaunchedURLClassLoader@20ad9418 JM.Log:INFO Set nacos log path: C:\Users\th-pc\logs\nacos
2019-05-18 17:01:56.872 INFO 10524 --- [ main] c.a.n.client.identify.CredentialWatcher : [] [] [] No credential found
2019-05-18 17:01:57.450 INFO 10524 --- [ main] o.s.c.a.n.c.NacosPropertySourceBuilder : Loading nacos data, dataId: 'blade.yaml', group: 'DEFAULT_GROUP'
2019-05-18 17:01:57.474 INFO 10524 --- [ main] o.s.c.a.n.c.NacosPropertySourceBuilder : Loading nacos data, dataId: 'blade-dev.yaml', group: 'DEFAULT_GROUP'
2019-05-18 17:01:57.486 INFO 10524 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='NACOS', propertySources=[NacosPropertySource {name='blade-dev.yaml'}, NacosPropertySource {name='blade.yaml'}]}
2019-05-18 17:01:57.505 INFO 10524 --- [ main] o.s.gateway.GateWayApplication : The following profiles are active: dev
2019-05-18 17:01:57.628 INFO 10524 --- [ main] onfigReactiveWebServerApplicationContext : Refreshing org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext@3a883ce7: startup date [Sat May 18 17:01:57 CST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@62043840
2019-05-18 17:01:58.446 WARN 10524 --- [ 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
2019-05-18 17:01:58.460 INFO 10524 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-18 17:01:58.466 ERROR 10524 --- [ 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:646) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.lambda$processDeferredImportSelectors$2(ConfigurationClassParser.java:566) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at java.util.ArrayList.forEach(Unknown Source) ~[na:1.8.0_151]
at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:563) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:188) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:271) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:91) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:692) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:530) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:67) ~[spring-boot-2.0.8.RELEASE.jar!/:2.0.8.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.0.8.RELEASE.jar!/:2.0.8.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) ~[spring-boot-2.0.8.RELEASE.jar!/:2.0.8.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.0.8.RELEASE.jar!/:2.0.8.RELEASE]
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:137) [spring-boot-2.0.8.RELEASE.jar!/:2.0.8.RELEASE]
at org.springblade.core.launch.BladeApplication.run(BladeApplication.java:48) [blade-core-launch-2.1.0.jar!/:na]
at org.springblade.gateway.GateWayApplication.main(GateWayApplication.java:35) [classes!/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_151]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_151]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_151]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [blade-gateway.jar:na]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [blade-gateway.jar:na]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [blade-gateway.jar:na]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [blade-gateway.jar: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.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReader.
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103) ~[spring-core-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:88) ~[spring-boot-2.0.8.RELEASE.jar!/:2.0.8.RELEASE]
at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:75) ~[spring-boot-2.0.8.RELEASE.jar!/:2.0.8.RELEASE]
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81) ~[spring-core-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:732) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getInterfaces(ConfigurationClassParser.java:961) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processInterfaces(ConfigurationClassParser.java:376) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:324) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:636) ~[spring-context-5.0.12.RELEASE.jar!/:5.0.12.RELEASE]
... 25 common frames omitted
看下主要错误: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
排查下是否给gateway或者blade-common引入了springboot-starter-web或者其他和web相关的依赖
gateway用的是webflux,若引入web会报错
very good
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
路由服务启动不了,还是报这个,配置文件中也没有web相关配置
扫一扫访问 Blade技术社区 移动端