springcloud eureka 遇到的神坑 freemarker.core.InvalidReferenceException: The following has evaluated to n

 

eureka核心配置

1.引用jar包

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-eureka-server</artifactId>
        <version>1.4.7.RELEASE</version>
    </dependency>

 2.application.yml配置(由于存在很不起眼的错误,所以导致了报错)正确配置文件在文末

server:
  port: 8002

#eureka配置
eureka:
  instance:
    hostname: localhost #eureka 实例名称
  client:
    register-with-eureka: false #是否向eureka注册中心注册自己
    fetch-registry: false #如果为FALSE表示自己为注册中心
    service-url: #监控页面 与eureka
      defaultZone: http//${eureka.instance.hostname}:${server.port}/eureka/

3.启动类配置

@SpringBootApplication
@EnableEurekaServer //EnableEurekaServer 服务中心启动类
public class SpringCloudEureka_8002 {
    public static void main(String[] args) {
        SpringApplication.run(SpringCloudEureka_8002.class,args);
    }
}

 

简单贴一下报错代码

freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> replica.key  [in template "eureka/navbar.ftl" at line 68, column 62]

----
Tip: It's the step after the last dot that caused this error, not those before it.
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

配置完成后访问(这是什么鬼?)

 后来经过检查发现是配置文件错误

 正确的application.yml 配置文件

server:
  port: 8002

#eureka配置
eureka:
  instance:
    hostname: localhost #eureka 实例名称
  client:
    register-with-eureka: false #是否向eureka注册中心注册自己
    fetch-registry: false #如果为FALSE表示自己为注册中心
    service-url: #监控页面 与eureka
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

配置完成后正常的访问界面应该是 路径 http://localhost:8002/   注8002是自己设置的端口号

 如果不是配置文件的问题也有人提出是用户名密码错误请参考

springcloud之eureka用户密码配置之血案

除了这两种情况暂时没有发现有其它问题会导致次错误,如果遇到会及时更新

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值