Spring boot项目整合apollo错误:for env UNKNOWN from com.ctrip.framework.apollo.internals.DefaultMetaServer
笔者在工作中遇到如下问题,随着程序功能越多,配置文件不断增加,一些功能的开关、服务器地址、接口地址、不同环境的一些配置文件不同,这些在每次发布不同环境、更新项目时都比较繁琐,后来学习微服务时接触到了Spring Cloud Config配置中心,用了一段时间发现比之前方便不少,但是还是比较繁琐和麻烦,而且功能还达不到生产级,只能小规模场景下使用,在中大规模企业场景下不建议采用。后来了解到携程Apollo配置中心,Apollo支持完善的管理界面,支持多环境,配置变更实时生效,权限和配置审计等多种生产级功能,而且在携程到微服务架构体系中也运用了这个,在国内众多互联网公司也有落地案例,就开始去接触了解。最后结合工作和学习的一些经验分享给大家Apollo的入门使用和一些走过的坑,本篇文章主要介绍使用Spring Boot项目整合Apollo配置中心遇到到一个错误。
推荐博客:
Apollo架构体系、Apollo运行原理、Apollo配置中心简单介绍:https://blog.csdn.net/zjh_746140129/article/details/86179522
Linux下配置安装Apollo、Centons下配置安装Apollo:https://blog.csdn.net/zjh_746140129/article/details/86179601
Spring Boot项目整合Apollo配置中心:https://blog.csdn.net/zjh_746140129/article/details/86361168
Spring boot项目整合apollo错误:for env UNKNOWN from com.ctrip.framework.apollo.internals.DefaultMetaServer
错误信息:
[code]App ID is set to test-demo by app.id property from System Property Environment is set to null. Because it is not available in either (1) JVM system property 'env', (2) OS env variable 'ENV' nor (3) property 'env' from the properties InputStream. Located meta services from apollo.meta configuration: http://192.168.234.155:8080! Located meta server address http://192.168.234.155:8080 for env UNKNOWN from com.ctrip.framework.apollo.internals.DefaultMetaServerProvider
解决方案:
启动项目时修改配置
-Denv=DEV
-Denv就是开发环境 DEV表示阿波罗里面的集群名称
linux服务器启动jar 也需要加一个这个,例如 java -Denv=DEV -jar abc.jar
启动查看控制台
- maven项目(错误一) 项目启动时报“org.springframework.core.env.ConfigurableEnvironment”的解决方案
- 利用命令部署springBoot项目出现ERROR] No plugin found for prefix ‘spring-boot’ in the current的错误
- spring boot 项目打包时报错 Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.
- Spring Boot 经常出现的错误:com.fasterxml.jackson.databind.ObjectWriter.forType
- 使用Maven构建项目,spring整合mybatis发生错误:Mapped Statements collection does not contain value for
- SpringBoot 集成Kotlin : org.hibernate.InstantiationException: No default constructor for entity: : com.easy.kotlin.entity.People
- SpringBoot项目创建报:java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication错误的解决方案
- Eclipse运行Maven的SpringMVC项目Run on Server时出现错误:Error configuring application listener of class org.springframework.web.context.ContextLoaderListener的问题解决
- Springboot整合dubbo构建maven多模块项目(三) - 把server分为api(服务接口定义)和server(服务实现)两个子module
- Spring Cloud ZooKeeper集成Feign的坑2,服务调用了一次后第二次调用就变成了500,错误:Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.n
- Spring boot项目整合thymeleaf和shiro
- org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.oskyhang.gbd.service.UserService] found for dependency: expected at least 1 bean which qualifies as aut
- log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment)
- DataTables warning : Requested unknown parameter '1' from the data source for row 0错误
- springboot学习(二)springboot项目整合前端,添加jsp的访问
- SpringBoot整合MyBatis的web项目
- Spring Boot整合CXF项目
- thymeleaf :springboot整合mybatis的web项目中使用html而不是jsp当页面渲染
- Spring Boot+Shiro+Redis(redisson)整合时,采用内嵌tomcat启动错误原因分析
- springboot创建项目问题:Failure to transfer org.codehaus.plexus:plexus-archiver:jar:2.0.1 from