29

I download the source demo code from spring-boot website when i import in the Intelj idea and start the application, the console has a WARN,which says

2017-08-14 12:23:23.609 WARN 2356 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : Unable to start LiveReload server

although the application was working, I still wanna know why it has this WARN!

Adam Kingsley
  • 451
  • 2
  • 5
  • 4
  • 1
    Here is the bean responsible for the exception https://github.com/spring-projects/spring-boot/blob/master/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java. As you can see the exception is not logged. Best way to know, add break point and debug – yamenk Aug 14 '17 at 06:50
  • 1
    Hi Adam, could you please accept my answer? It will help keep Stackoverflow clean. Tnx! – HammerNL Apr 16 '18 at 12:56

3 Answers3

40

In my case I have two Spring Boot services running simultaneously too. Of course disabling the live-reload completely will work, but there's also a property you can set to choose a different port.

Simply add the following to your application.yml (or properties equivalent). The default is 35729.

spring: devtools: livereload: port: 35730

kossmoboleat
  • 1,841
  • 1
  • 19
  • 36
12

I ran into this issue too. Like you said, it's not preventing your app from working properly, it's just that I'd like to avoid warnings wherever possible (especially the ones I can not explain!).

In my case I'm running 2 Spring Boot applications simultaneously, which is exactly the reason for this warning. The LiveReload server is then also started twice, while the port it wants to use (35729) can obviously be bound to only once.

So I started looking for a way to change the LiveReload server port for one of my two applications. The best I could find is:

http://livereload.com/tips/change-port-number-livereload-listens-on/

The option where I would need to set an environment variable LRPortOverride containing the new port number seemed feasible to me. However, no matter what I tried, my environment variable was simply ignored. So no cigar there :-(

Thus, my search continued and I finally found this:

https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-devtools.html#using-boot-devtools-livereload

This confirms my conclusion and also provides a solution for my problem. I simply added

spring.devtools.livereload.enabled=false

to the Spring application.properties of one of my applications, and the issue was fixed.

Hope this will help you too.

HammerNL
  • 1,689
  • 18
  • 22
1

Restarting the device solves the issue for me. I hope this will work for everyone. Because, after restarting the occupied port becomes free.

But I know this is not a good solution. Changing the default port could be a better solution.

Musadul Islam
  • 341
  • 3
  • 11