Search code examples
spring-bootyamlspring-cloudnetflix-eurekaspring-boot-actuator

Error init SpringBoot 2.1.8.RELEASE using actuator


I have a SpringBoot 2.1.8.RELEASE, but when I start the app. I got this error:

2019-10-01 10:38:24.373 ERROR 16232 --- [           main] d.c.b.a.s.c.d.InstanceDiscoveryListener  : Couldn't register instance for discovered instance...
    java.lang.IllegalArgumentException: Illegal character in authority at index 7: http://127.0.0.1:2222${server.contextPath}/actuator/health
        at java.net.URI.create(URI.java:852)
        at de.codecentric.boot.admin.server.cloud.discovery.EurekaServiceInstanceConverter.getHealthUrl(EurekaServiceInstanceConverter.java:45)

and I have this properties defined in my yml file

server:
  port: 2222
  servlet:
    contextPath:

Solution

  • Just remove

     servlet:
         contextPath:
    

    and try hitting your API.

    If you want default path of the application then

    servlet:
     contextPath: /api
    

    Then your API looks like :

    http://127.0.0.1:2222/api/actuator/health