iis服务器助手广告
返回顶部
首页 > 资讯 > 数据库 >本地nacos启动失败,org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean **
  • 626
分享到

本地nacos启动失败,org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean **

javamysql 2023-09-03 13:09:03 626人浏览 独家记忆
摘要

总结:nacos-2.x.x要使用mysql5.7.x 项目使用若依3.1.0-cloud版本,因此要使用Nacos-2.x.x的版本,下载并安装nacos后, 配置application.properties里的Config Module

总结:nacos-2.x.x要使用mysql5.7.x

项目使用若依3.1.0-cloud版本,因此要使用Nacos-2.x.x的版本,下载并安装nacos后,

配置application.properties里的Config Module Related Configurations模块,

#*************** Config Module Related Configurations ***************#
### If use Mysql as datasource:
 spring.datasource.platfORM=mysql

### Count of DB:
 db.num=1

### Connect URL of DB:
 db.url.0=jdbc:mysql://127.0.0.1:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&SocketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
 db.user.0=SYC
 db.passWord.0=123

然后再启动startup.cmd时会报错,需要使用单机模式,

编辑startup.cmd,设置里面的MODE为standalone

set MODE="standalone"
set FUNCTION_MODE="all"
set SERVER=nacos-server
set MODE_INDEX=-1
set FUNCTION_MODE_INDEX=-1
set SERVER_INDEX=-1
set EMBEDDED_STORAGE_INDEX=-1
set EMBEDDED_STORAGE=""

再次启动时报错

2022-09-09 16:30:29,073 ERROR Startup errors :

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'memoryMonitor' defined in URL [jar:file:/D:/Software/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-config-2.1.1.jar!/com/alibaba/nacos/config/server/monitor/MemoryMonitor.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'asyncNotifyService': Unsatisfied dependency expressed through field 'dumpService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalDumpService': Invocation of init method failed; nested exception is ErrCode:500, ErrMsg:Nacos Server did not start because dumpservice bean construction failure :
No DataSource set
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.create

看着No DataSource set猜测可能是链接数据库问题,使用的mysql为5.6.x

升级为5.7.x

再次启动成功

"nacos is starting with standalone"

         ,--.
       ,--.'|
   ,--,:  : |                                           Nacos 2.1.1
,`--.'`|  ' :                       ,---.               Running in stand alone mode, All function modules
|   :  :  | |                      '   ,'\   .--.--.    Port: 8848
:   |   \ | :  ,--.--.     ,---.  /   /   | /  /    '   Pid: 22716
|   : '  '; | /       \   /     \.   ; ,. :|  :  /`./   Console: Http://192.168.56.1:8848/nacos/index.html
'   ' ;.    ;.--.  .-. | /    / ''   | |: :|  :  ;_
|   | | \   | \__\/: . ..    ' / '   | .; : \  \    `.      https://nacos.io
'   : |  ; .' ," .--.; |'   ; :__|   :    |  `----.   \
|   | '`--'  /  /  ,.  |'   | '.'|\   \  /  /  /`--'  /
'   : |     ;  :   .'   \   :    : `----'  '--'.     /
;   |.'     |  ,     .-./\   \  /            `--'---'
'---'        `--`---'     `----'

2022-09-09 16:43:26,404 INFO Tomcat initialized with port(s): 8848 (http)

2022-09-09 16:43:26,501 INFO Root WEBApplicationContext: initialization completed in 2700 ms

2022-09-09 16:43:29,845 INFO Adding welcome page: class path resource [static/index.html]

2022-09-09 16:43:30,149 WARN You are asking Spring Security to ignore Ant [pattern='/**']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.

2022-09-09 16:43:30,150 INFO Will not secure Ant [pattern='/**']

2022-09-09 16:43:30,175 INFO Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@62e70ea3, org.springframework.security.web.context.SecurityContextPersistenceFilter@186978a6, org.springframework.security.web.header.HeaderWriterFilter@34a75079, org.springframework.security.web.csrf.CsrfFilter@72a85671, org.springframework.security.web.authentication.loGout.LogoutFilter@7a7471ce, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@482d776b, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@132ddbab, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@3efe7086, org.springframework.security.web.session.SessionManagementFilter@107ed6fc, org.springframework.security.web.access.ExceptionTranslationFilter@631e06ab]

2022-09-09 16:43:30,195 INFO Exposing 1 endpoint(s) beneath base path '/actuator'

2022-09-09 16:43:30,238 INFO Tomcat started on port(s): 8848 (http) with context path '/nacos'

2022-09-09 16:43:30,259 INFO Nacos started successfully in stand alone mode. use external storage
 

来源地址:https://blog.csdn.net/qq_31839075/article/details/126785659

您可能感兴趣的文档:

--结束END--

本文标题: 本地nacos启动失败,org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean **

本文链接: https://www.lsjlt.com/news/392234.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作