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

lamp-gateway-server模块启动报错 #72

Closed
flag-bug opened this issue Jan 17, 2021 · 8 comments
Closed

lamp-gateway-server模块启动报错 #72

flag-bug opened this issue Jan 17, 2021 · 8 comments

Comments

@flag-bug
Copy link

版本信息:

JDK 版本(必填) : 1.8.x
源码版本(必填):3.0.2
MySQL(必填): 8.0.21
Nacos(必填):1.3.2

问题描述:

已使用maven helper工具查看依赖,没有spring-webmvc依赖,lamp-gateway-server.yml中配置了lamp.webmvc.enabled=false,如你所说在lamp-boot-util中GlobalMvcConfigurer实现了WebMvcConfigurer,但依赖lamp-boot-util已经排除了spring-webmvc依赖,还要怎么排除GlobalMvcConfigurer?报错中是LampRabbitMqConfiguration$RabbitMqConfiguration,这里面没有发现有关springmvc的东西?

报错截图

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
[lamp-gateway-server:0000::] 2021-01-17 20:27:34.827:[ERROR] [12412] [] [main:24863] [org.springframework.boot.SpringApplication.reportFailure:837] Application run failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.tangyh.basic.mq.LampRabbitMqConfiguration$RabbitMqConfiguration]; 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:610)
at org.springframework.context.annotation.ConfigurationClassParser.access$800(ConfigurationClassParser.java:111)
at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.lambda$processGroupImports$1(ConfigurationClassParser.java:812)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:809)
at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:780)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:319)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:280)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533)
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:62)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at com.tangyh.lamp.GatewayServerApplication.main(GatewayServerApplication.java:34)
Caused by: java.io.FileNotFoundException: class path resource [org/springframework/web/servlet/config/annotation/WebMvcConfigurer.class] cannot be opened because it does not exist

重现步骤

  1. nacos、redis、rabbitmq正常启动部署了,nacos中关于mysql、redis、rabbitmq的配置已经修改为和本地一致
  2. lamp-util 3.0.2正常install
  3. 启动lamp-gateway-server,报错!
@zuihou
Copy link
Collaborator

zuihou commented Jan 17, 2021

参考: #45

@flag-bug
Copy link
Author

没有自建服务,这是lamp源码没有改动的

@zuihou
Copy link
Collaborator

zuihou commented Jan 17, 2021

  1. 建议认真阅读文档 快速启动 章节。
    https://www.kancloud.cn/zuihou/zuihou-admin-cloud/1284756

  2. 认真理解和观察常见报错:
    (lamp-gateway-server)zuihou-gateway-server 模块启动报错 #57
    启动报错: class path resource [com/github/zuihou/mq/MyRabbitMqConfiguration$RabbitMqConfiguration.clss] #45

  3. 对比nacos中 lamp-gateway-server.yml 的内容和 lamp-cloud/01-third-party/nacos/clientConfig/lamp-gateway-server.yml的内容

@flag-bug
Copy link
Author

好的,谢谢,问题已解决!

@zuihou
Copy link
Collaborator

zuihou commented Jan 17, 2021

麻烦回复下解决方案

@flag-bug
Copy link
Author

因为我的nacos导入配置没有注意命名空间,所以没有获取到nacos配置

@flag-bug
Copy link
Author

项目中用的Apollo,第一次用nacos,所以犯了这么简单的错误

@flag-bug
Copy link
Author

还是没有认真看文档,如果认真看了文档就不会瞎弄半天,百思不得其解

@zuihou zuihou reopened this Jan 17, 2021
@zuihou zuihou closed this as completed Jan 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants