栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Nacos-源码分析(环境准备)

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Nacos-源码分析(环境准备)

拉取代码

Nacos官网地址下载
下载对应的tag版本

我这里以1.4.1版本为演示版本

编译代码


找不到包com.alibaba.nacos.consistency.entity,原因是应为这个需要protobuf编译生成,我们可以安装protobuf打包工具生成这个包,当然我们也有简单的办法就是install一下consistency这个模块。

运行代码


报错如下

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204)
	at com.alibaba.nacos.Nacos.main(Nacos.java:35)

原因是环境变量有些问题,我们在main方法中添加两行代码

	public static void main(String[] args) {
        System.setProperty("nacos.standalone", "true");
        System.setProperty("nacos.core.auth.enabled", "false");
        SpringApplication.run(Nacos.class, args);
    }

重新启动

访问测试

持久化数据库

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/686453.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号