eureka编写注册中心出现Error executing FreeMarker template...

发布时间 2023-08-12 10:48:18作者: XLouis

在配置号eureka注册中心后,启动前端页面时出现:

前端页面:

FreeMarker template error (DEBUG mode; use RETHROW in production!): The following has evaluated to null or missing: ==> replica.key [in template "eureka/navbar.ftlh" 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!

 

后端控制台出现:

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

 

原因是当时我写的yml文件中url写错

 

defaultZone:${eureka.instance.hostname}:${spring.application.name}:${server.port}/eureka
修改为:可以正常显示
defaultZone: http://localhost:8761/eureka #单机版服务注册中心