Nacos版本差异导致的启动失败问题(Windows10下)解决办法

解决办法:

      将startup.cmd中的set MODE="cluster"修改为set MODE="standalone"。

在Windows10下启动Nacos1.1.3正常,但是尝试启动Nacos1.3.2和1.4.0时,却总是失败!部分异常如下:

"nacos is starting with cluster"
         ,--.
       ,--.'|
   ,--,:  : |                                           Nacos 1.4.0
,`--.'`|  ' :                       ,---.               Running in cluster mode, All function modules
|   :  :  | |                      '   ,'\   .--.--.    Port: 8848
:   |   \ | :  ,--.--.     ,---.  /   /   | /  /    '   Pid: 31804
|   : '  '; | /       \   /     \.   ; ,. :|  :  /`./   Console: http://192.168.0.100:8848/nacos/index.html
'   ' ;.    ;.--.  .-. | /    / ''   | |: :|  :  ;_
|   | | \   | \__\/: . ..    ' / '   | .; : \  \    `.      https://nacos.io
'   : |  ; .' ," .--.; |'   ; :__|   :    |  `----.   \
|   | '`--'  /  /  ,.  |'   | '.'|\   \  /  /  /`--'  /
'   : |     ;  :   .'   \   :    : `----'  '--'.     /
;   |.'     |  ,     .-./\   \  /            `--'---'
'---'        `--`---'     `----'
java.io.IOException: java.lang.IllegalArgumentException: db.num is null
        at com.alibaba.nacos.config.server.service.datasource.ExternalDataSourceServiceImpl.reload(ExternalDataSourceServiceImpl.java:141)
        at com.alibaba.nacos.config.server.service.datasource.ExternalDataSourceServiceImpl.init(ExternalDataSourceServiceImpl.java:115)
Caused by: java.lang.IllegalArgumentException: db.num is null
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:135)
        at com.alibaba.nacos.config.server.service.datasource.ExternalDataSourceProperties.build(ExternalDataSourceProperties.java:96)
        at com.alibaba.nacos.config.server.service.datasource.ExternalDataSourceServiceImpl.reload(ExternalDataSourceServiceImpl.java:130)
        ... 168 more
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authFilterRegistration' defined in class path resource [com/alibaba/nacos/core/auth/AuthConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.FilterRegistrationBean]: Factory method 'authFilterRegistration' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'authFilter': Unsatisfied dependency expressed through field 'authManager'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nacosAuthManager': Unsatisfied dependency expressed through field 'authenticationManager'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nacosAuthConfig': Unsatisfied dependency expressed through field 'userDetailsService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nacosUserDetailsServiceImpl': Unsatisfied dependency expressed through field 'userPersistService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'externalUserPersistServiceImpl': Unsatisfied dependency expressed through field 'persistService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalStoragePersistServiceImpl': Invocation of init method failed; nested exception is java.lang.RuntimeException: java.lang.RuntimeException: [db-load-error]load jdbc.properties error
Caused by: java.lang.RuntimeException: [db-load-error]load jdbc.properties error
2020-12-15 19:26:09,273 ERROR Nacos failed to start, please see D:\Soft-Dellvostro\Soft\Distributed\Tools\nacos-server-1.4.0\logs\nacos.log for more details.

查了好长时间,未发现有用的线索。无奈之下,只好从头开始分析日志。

开头的"nacos is starting with cluster",意为nacos以群集模式启动。于是,查了一下1.1.3到1.3.2再到1.4.0的相关差异,得知1.3.2和1.4.0的默认启动模式就是集群模式。而集群模式在没有进行集群配置的情况下,就会启动失败。

另外,application.properties的所有配置使用默认值即可。我之前尝试解决启动失败问题,曾将application.properties中# spring.datasource.platform=mysql的注释取消了。该注释取消之后,也会导致Nacos启动失败。

启动成功后,命令行界面显示如下:

2020-12-15 20:07:05,867 INFO Nacos started successfully in stand alone mode. use embedded storage

 

  • 18
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值